fix for 404 on empty search results

This commit is contained in:
keyan 2024-01-19 15:12:47 -06:00
parent 64e49934d4
commit c41ad5d469
1 changed files with 16 additions and 2 deletions

View File

@ -146,6 +146,13 @@ export default {
return `(${e._source.id}, ${i})`
}).join(',')
if (values.length === 0) {
return {
cursor: null,
items: []
}
}
const items = await itemQueryWithMeta({
me,
models,
@ -342,7 +349,7 @@ export default {
const whenRange = when === 'custom'
? {
gte: whenFrom,
lte: new Date(Math.min(new Date(whenTo), decodedCursor.time))
lte: new Date(Math.min(new Date(Number(whenTo)), decodedCursor.time))
}
: {
lte: decodedCursor.time,
@ -366,7 +373,7 @@ export default {
function_score: {
query: {
bool: {
...(sort === 'recent' ? { must: termQueries } : { should: termQueries }),
must: termQueries,
filter: [
...whatArr,
me
@ -421,6 +428,13 @@ export default {
return `(${e._source.id}, ${i})`
}).join(',')
if (values.length === 0) {
return {
cursor: null,
items: []
}
}
const items = (await itemQueryWithMeta({
me,
models,