fix: exact search not work as expected
This commit is contained in:
parent
a4db914b45
commit
b2356d2995
1 changed files with 8 additions and 5 deletions
|
|
@ -23,17 +23,20 @@ export class SearchController extends Controller {
|
||||||
bool: {
|
bool: {
|
||||||
must: search.AND?.map((v) => ({
|
must: search.AND?.map((v) => ({
|
||||||
[type[search.exact || v.exact ? 1 : 0]]: { [v.field]: v.value },
|
[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) => ({
|
should: search.OR?.map((v) => ({
|
||||||
[type[search.exact || v.exact ? 1 : 0]]: { [v.field]: v.value },
|
[type[search.exact || v.exact ? 1 : 0]]: { [v.field]: v.value },
|
||||||
})),
|
})),
|
||||||
must_not: {
|
must_not: {
|
||||||
match: { hidden: true },
|
match: { hidden: true },
|
||||||
},
|
},
|
||||||
|
filter: [
|
||||||
|
{
|
||||||
|
[["match", "prefix"][search.recursive ? 1 : 0]]: {
|
||||||
|
path: search.path?.join("/") || "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
size: 10000,
|
size: 10000,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue