|
|
@ -177,10 +177,16 @@
|
|
|
|
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) {
|
|
|
|
const finalResults = allIds.map(fetch)
|
|
|
|
return []
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return [...results[0].result]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const allIds = [...getByField('title'), ...getByField('content')]
|
|
|
|
|
|
|
|
const finalResults = allIds.map(fetch)
|
|
|
|
|
|
|
|
|
|
|
|
// display
|
|
|
|
// display
|
|
|
|
if (finalResults.length === 0) {
|
|
|
|
if (finalResults.length === 0) {
|
|
|
|