search patch
This commit is contained in:
parent
555f293801
commit
e55361d476
@ -177,9 +177,15 @@
|
||||
limit: 5,
|
||||
}
|
||||
]).then(searchResults => {
|
||||
const titleIds = [...searchResults.filter(x => x.field === 'title')?.[0].result] ?? []
|
||||
const contentIds = [...searchResults.filter(x => x.field === 'content')?.[0].result] ?? []
|
||||
const allIds = [...titleIds, ...contentIds]
|
||||
const getByField = field => {
|
||||
const results = searchResults.filter(x => x.field === field)
|
||||
if (results.length === 0) {
|
||||
return []
|
||||
} else {
|
||||
return [...results[0].result]
|
||||
}
|
||||
}
|
||||
const allIds = [...getByField('title'), ...getByField('content')]
|
||||
const finalResults = allIds.map(fetch)
|
||||
|
||||
// display
|
||||
|
Loading…
Reference in New Issue
Block a user