fix: exact search not work as expected

This commit is contained in:
Methapon2001 2024-01-15 09:39:11 +07:00
parent a4db914b45
commit b2356d2995
No known key found for this signature in database
GPG key ID: 849924FEF46BD132

View file

@ -23,17 +23,20 @@ export class SearchController extends Controller {
bool: {
must: search.AND?.map((v) => ({
[type[search.exact || v.exact ? 1 : 0]]: { [v.field]: v.value },
})).concat({
[["match", "prefix"][search.recursive ? 1 : 0]]: {
path: search.path?.join("/") || "",
},
}),
})),
should: search.OR?.map((v) => ({
[type[search.exact || v.exact ? 1 : 0]]: { [v.field]: v.value },
})),
must_not: {
match: { hidden: true },
},
filter: [
{
[["match", "prefix"][search.recursive ? 1 : 0]]: {
path: search.path?.join("/") || "",
},
},
],
},
},
size: 10000,