diff --git a/TODO.md b/TODO.md index fb47badb..98aa68ba 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,2 @@ -1. Make it possible to search nutrient values (ES object type) -2. Index taxonomies in separate indices and allow to do search-as-you-type on taxonomies -4. Remove obsolete products from collection -5. Fix luqum parser that search in "text" field when searching: '"match phrase"' \ No newline at end of file +1. Index taxonomies in separate indices and allow to do search-as-you-type on taxonomies +2. Fix luqum parser that search in "text" field when searching: '"match phrase"' \ No newline at end of file diff --git a/tests/unit/test_query.py b/tests/unit/test_query.py index 5f361173..37c7f1c2 100644 --- a/tests/unit/test_query.py +++ b/tests/unit/test_query.py @@ -65,6 +65,11 @@ def test_transform(self, query: str, expected: str): {"term": {"states_tags": {"value": "en:spain"}}}, "", ), + ( + "nutriments.salt_100g:[2 TO *]", + {"range": {"nutriments.salt_100g": {"gte": "2"}}}, + "", + ), ], ) def test_parse_lucene_dsl_query( @@ -72,7 +77,8 @@ def test_parse_lucene_dsl_query( ): query_builder = ElasticsearchQueryBuilder( default_operator=ElasticsearchQueryBuilder.MUST, - not_analyzed_fields=["states_tags", "labels_tags"], + not_analyzed_fields=["states_tags", "labels_tags", "countries_tags"], + object_fields=["nutriments", "nutriments.salt_100g"], ) filter_clauses, remaining_terms = parse_lucene_dsl_query(q, query_builder) assert filter_clauses == expected_filter_clauses