mirror of
https://github.com/falsycat/ar.falsy.cat.git
synced 2024-12-26 08:24:51 +00:00
search patch
This commit is contained in:
parent
df23b99951
commit
8ca31df3f2
@ -177,9 +177,15 @@
|
|||||||
limit: 5,
|
limit: 5,
|
||||||
}
|
}
|
||||||
]).then(searchResults => {
|
]).then(searchResults => {
|
||||||
const titleIds = [...searchResults.filter(x => x.field === 'title')?.[0].result] ?? []
|
const getByField = field => {
|
||||||
const contentIds = [...searchResults.filter(x => x.field === 'content')?.[0].result] ?? []
|
const results = searchResults.filter(x => x.field === field)
|
||||||
const allIds = [...titleIds, ...contentIds]
|
if (results.length === 0) {
|
||||||
|
return []
|
||||||
|
} else {
|
||||||
|
return [...results[0].result]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allIds = [...getByField('title'), ...getByField('content')]
|
||||||
const finalResults = allIds.map(fetch)
|
const finalResults = allIds.map(fetch)
|
||||||
|
|
||||||
// display
|
// display
|
||||||
|
Loading…
Reference in New Issue
Block a user