From 8f56ad4a3b5b83adaf59fc03ded68d7ef68b55f8 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 14 Apr 2020 18:16:44 +0200 Subject: [PATCH] feature: hashtag inserted and taken over in search --- .../features/SearchResults/SearchResults.vue | 106 +++++++++++++++--- webapp/graphql/Search.js | 29 +++-- 2 files changed, 115 insertions(+), 20 deletions(-) diff --git a/webapp/components/_new/features/SearchResults/SearchResults.vue b/webapp/components/_new/features/SearchResults/SearchResults.vue index 3b0c2d08a..46d78dd43 100644 --- a/webapp/components/_new/features/SearchResults/SearchResults.vue +++ b/webapp/components/_new/features/SearchResults/SearchResults.vue @@ -2,10 +2,10 @@
@@ -15,6 +15,7 @@ + {{postPage}} +
    +
  • + + + +
  • + +
diff --git a/webapp/graphql/Search.js b/webapp/graphql/Search.js index b99736985..98bd007f4 100644 --- a/webapp/graphql/Search.js +++ b/webapp/graphql/Search.js @@ -6,13 +6,9 @@ export const searchQuery = gql` ${postFragment} ${tagsCategoriesAndPinnedFragment} - query($query: String!, $firstPosts: Int, $firstUsers: Int, $offset: Int) { - searchResults( - query: $query - firstPosts: $firstPosts - firstUsers: $firstUsers - offset: $offset - ) { + query($query: String!) { + searchResults(query: $query, limit: 5) + { __typename ... on Post { ...post @@ -40,6 +36,8 @@ export const searchPosts = gql` query($query: String!, $firstPosts: Int, $postsOffset: Int) { searchPosts(query: $query, firstPosts: $firstPosts, postsOffset: $postsOffset) { + postCount + posts { __typename ...post ...tagsCategoriesAndPinned @@ -49,6 +47,7 @@ export const searchPosts = gql` ...user } } + } } ` @@ -57,8 +56,24 @@ export const searchUsers = gql` query($query: String!, $firstUsers: Int, $usersOffset: Int) { searchUsers(query: $query, firstUsers: $firstUsers, usersOffset: $usersOffset) { + userCount + users { __typename ...user + } + } + } +` + +export const searchHashtags = gql` + + query($query: String!, $firstHashtags: Int, $hashtagsOffset: Int) { + searchHashtags(query: $query, firstHashtags: $firstHashtags, hashtagsOffset: $hashtagsOffset) { + hashtagCount + hashtags { + __typename + id + } } } `