feat: search + basic engine (wip)
This commit is contained in:
@@ -16,7 +16,18 @@ module.exports = {
|
||||
offsetPage: args.offsetPage || 0,
|
||||
offsetSize: args.offsetSize || 100
|
||||
})
|
||||
}
|
||||
},
|
||||
async search (obj, args, context) {
|
||||
if (WIKI.data.searchEngine) {
|
||||
return WIKI.data.searchEngine.query(args.query, args)
|
||||
} else {
|
||||
return {
|
||||
results: [],
|
||||
suggestions: [],
|
||||
totalHits: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
PageMutation: {
|
||||
async create(obj, args, context) {
|
||||
|
@@ -20,6 +20,12 @@ type PageQuery {
|
||||
offsetPage: Int
|
||||
offsetSize: Int
|
||||
): PageHistoryResult @auth(requires: ["manage:system", "read:pages"])
|
||||
|
||||
search(
|
||||
query: String!
|
||||
path: String
|
||||
locale: String
|
||||
): PageSearchResponse! @auth(requires: ["manage:system", "read:pages"])
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
@@ -88,3 +94,17 @@ type PageHistoryResult {
|
||||
trail: [PageHistory]
|
||||
total: Int!
|
||||
}
|
||||
|
||||
type PageSearchResponse {
|
||||
results: [PageSearchResult]!
|
||||
suggestions: [String]!
|
||||
totalHits: Int!
|
||||
}
|
||||
|
||||
type PageSearchResult {
|
||||
id: Int!
|
||||
title: String!
|
||||
description: String!
|
||||
path: String!
|
||||
locale: String!
|
||||
}
|
||||
|
Reference in New Issue
Block a user