feat: search under folder

This commit is contained in:
Methapon2001 2024-01-10 17:34:43 +07:00
parent acc243a432
commit d33a9c475e
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
2 changed files with 7 additions and 1 deletions

View file

@ -23,7 +23,11 @@ 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 },
})),

View file

@ -10,4 +10,6 @@ export interface Search {
exact?: boolean;
}[];
exact?: boolean;
recursive?: boolean;
path?: string[];
}