Enable elastic query syntax (#1202)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2022-03-25 15:04:46 +06:00 committed by GitHub
parent dd809242b1
commit e875f51ad3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,14 +27,13 @@ class ElasticAdapter implements FullTextAdapter {
async search (_class: Ref<Class<Doc>>, query: DocumentQuery<Doc>, size: number | undefined, from: number | undefined): Promise<IndexedDoc[]> {
if (query.$search === undefined) return []
const search = query.$search.replace(/[\\/+\-=&><!()|{}^"~*&:[\]]/g, '\\$&')
const request: any = {
bool: {
must: [
{
multi_match: {
query: search
query_string: {
query: query.$search,
default_operator: 'and'
}
}
],