mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-01 21:31:04 +00:00
Enable elastic query syntax (#1202)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
dd809242b1
commit
e875f51ad3
@ -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[]> {
|
async search (_class: Ref<Class<Doc>>, query: DocumentQuery<Doc>, size: number | undefined, from: number | undefined): Promise<IndexedDoc[]> {
|
||||||
if (query.$search === undefined) return []
|
if (query.$search === undefined) return []
|
||||||
const search = query.$search.replace(/[\\/+\-=&><!()|{}^"~*&:[\]]/g, '\\$&')
|
|
||||||
|
|
||||||
const request: any = {
|
const request: any = {
|
||||||
bool: {
|
bool: {
|
||||||
must: [
|
must: [
|
||||||
{
|
{
|
||||||
multi_match: {
|
query_string: {
|
||||||
query: search
|
query: query.$search,
|
||||||
|
default_operator: 'and'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user