allow sort for search queries with only filters (#2012)

This commit is contained in:
Edward Kung 2025-03-23 09:53:45 -07:00 committed by GitHub
parent 3ff03960eb
commit f20ebad772
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -276,11 +276,15 @@ export default {
// if nym, items must contain nym
if (nym) {
filters.push({ wildcard: { 'user.name': `*${nym.slice(1).toLowerCase()}*` } })
// push same requirement to termQueries to avoid empty should clause
termQueries.push({ wildcard: { 'user.name': `*${nym.slice(1).toLowerCase()}*` } })
}
// if territory, item must be from territory
if (territory) {
filters.push({ match: { 'sub.name': territory.slice(1) } })
// push same requirement to termQueries to avoid empty should clause
termQueries.push({ match: { 'sub.name': territory.slice(1) } })
}
// if quoted phrases, items must contain entire phrase