mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Fix Search.feature in a hacky way
Ok, we have no control what parameters are passed to the cypher query
generated by `neo4j-graphql-js`. So I'm re-using the `filter` param.
If the `$filter` param is `{}` then we can use COALESCE to turn that
into empty array. Ugh.
This commit is contained in:
parent
717147bd0c
commit
6fb926e735
@ -4,15 +4,16 @@ type Query {
|
||||
currentUser: User
|
||||
# Get the latest Network Statistics
|
||||
statistics: Statistics!
|
||||
findPosts(filter: String!, limit: Int = 10): [Post]!
|
||||
findPosts(query: String!, limit: Int = 10): [Post]!
|
||||
@cypher(
|
||||
statement: """
|
||||
CALL db.index.fulltext.queryNodes('full_text_search', $filter)
|
||||
CALL db.index.fulltext.queryNodes('full_text_search', $query)
|
||||
YIELD node as post, score
|
||||
MATCH (post)<-[:WROTE]-(user:User)
|
||||
WHERE score >= 0.2
|
||||
AND NOT user.deleted = true AND NOT user.disabled = true
|
||||
AND NOT post.deleted = true AND NOT post.disabled = true
|
||||
AND NOT user.id in COALESCE($filter.author_not.id_in, [])
|
||||
RETURN post
|
||||
LIMIT $limit
|
||||
"""
|
||||
|
||||
@ -46,8 +46,8 @@ export const actions = {
|
||||
await this.app.apolloProvider.defaultClient
|
||||
.query({
|
||||
query: gql(`
|
||||
query findPosts($filter: String!) {
|
||||
findPosts(filter: $filter, limit: 10) {
|
||||
query findPosts($query: String!) {
|
||||
findPosts(query: $query, limit: 10) {
|
||||
id
|
||||
slug
|
||||
label: title
|
||||
@ -64,7 +64,7 @@ export const actions = {
|
||||
}
|
||||
`),
|
||||
variables: {
|
||||
filter: value.replace(/\s/g, '~ ') + '~',
|
||||
query: value.replace(/\s/g, '~ ') + '~',
|
||||
},
|
||||
})
|
||||
.then(res => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user