Skip to content

Commit b8b64d4

Browse files
committed
gis-8556 elastic-lucene-query tokenizer fixes
1 parent 4adffd5 commit b8b64d4

File tree

1 file changed

+5
-2
lines changed
  • uncoder-core/app/translator/platforms/base/lucene

1 file changed

+5
-2
lines changed

uncoder-core/app/translator/platforms/base/lucene/tokenizer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class LuceneTokenizer(QueryTokenizer, ANDLogicOperatorMixin):
3838
":>": OperatorType.GT,
3939
":<": OperatorType.LT,
4040
":": OperatorType.EQ,
41+
"==": OperatorType.EQ,
4142
}
4243
multi_value_operators_map: ClassVar[dict[str, str]] = {":": OperatorType.EQ}
4344

@@ -61,7 +62,7 @@ class LuceneTokenizer(QueryTokenizer, ANDLogicOperatorMixin):
6162

6263
multi_value_pattern = rf"""\((?P<{ValueType.multi_value}>[:a-zA-Z\"\*0-9=+%#№;\-_\/\\'\,.$&^@!\(\[\]\s|]+)\)"""
6364
multi_value_check_pattern = r"___field___\s*___operator___\s*\("
64-
multi_value_delimiter_pattern = r"\s+OR\s+"
65+
multi_value_delimiter_pattern = r"\s+OR|or\s+"
6566

6667
escape_manager = lucene_escape_manager
6768

@@ -77,7 +78,9 @@ def create_field_value(field_name: str, operator: Identifier, value: Union[str,
7778

7879
@staticmethod
7980
def clean_multi_value(value: str) -> str:
80-
return value.strip('"') if value.startswith('"') and value.endswith('"') else value
81+
value = value.strip('"') if value.startswith('"') and value.endswith('"') else value
82+
value = value.replace("\n", "").replace(" ", "")
83+
return value.strip()
8184

8285
def get_operator_and_value( # noqa: PLR0911
8386
self, match: re.Match, mapped_operator: str = OperatorType.EQ, operator: Optional[str] = None

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy