mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Tidy up a bit
- Remove unused function - Add wildcard to end of query to remove quirky behavior - Favor more verbose variable naming
This commit is contained in:
parent
7ee57033be
commit
f7de76eea5
@ -1,5 +1,3 @@
|
||||
import { filterForBlockedUsers } from './helpers/filterForBlockedUsers'
|
||||
|
||||
const transformReturnType = record => {
|
||||
return {
|
||||
__typename: record.get('type'),
|
||||
@ -12,7 +10,7 @@ export default {
|
||||
const { query, limit } = args
|
||||
const { id: thisUserId } = context.user
|
||||
// see http://lucene.apache.org/core/8_3_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package.description
|
||||
const myQuery = query.replace(/\s/g, '* ') + '*'
|
||||
const myQuery = query + '*'
|
||||
const postCypher = `
|
||||
CALL db.index.fulltext.queryNodes('post_fulltext_search', $query)
|
||||
YIELD node as resource, score
|
||||
@ -63,9 +61,9 @@ export default {
|
||||
} finally {
|
||||
session.close()
|
||||
}
|
||||
let result = [...postResults.records, ...userResults.records]
|
||||
result = result.map(transformReturnType)
|
||||
return result
|
||||
let searchResults = [...postResults.records, ...userResults.records]
|
||||
searchResults = searchResults.map(transformReturnType)
|
||||
return searchResults
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user