Skip to content

Commit

Permalink
fix: fix bug in parse_lucene_query
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Sep 22, 2023
1 parent b4a3491 commit ea25d36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
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
3. Add a limit to number of page queryable (=10k results)
4. Remove obsolete products from collection
4. Remove obsolete products from collection
5. Fix luqum parser that search in "text" field when searching: '"match phrase"'
13 changes: 9 additions & 4 deletions app/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,15 @@ def parse_lucene_dsl_query(

if luqum_tree is not None:
logger.debug("parsed luqum tree: %s", repr(luqum_tree))
# We join with space every non word not recognized by the parser
remaining_terms = " ".join(
item.value for item in luqum_tree.children if isinstance(item, Word)
)
if luqum_tree.children:
# We join with space every non word not recognized by the parser
remaining_terms = " ".join(
item.value for item in luqum_tree.children if isinstance(item, Word)
)
else:
# single term
remaining_terms = luqum_tree.value

processed_tree = UnknownOperationRemover().visit(luqum_tree)
logger.debug("processed luqum tree: %s", repr(processed_tree))
if processed_tree.children:
Expand Down

0 comments on commit ea25d36

Please sign in to comment.