Skip to content

Commit

Permalink
work on AND operator
Browse files Browse the repository at this point in the history
  • Loading branch information
capjamesg committed Nov 23, 2024
1 parent 0906b7c commit af6bdc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jamesql/query_simplifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ def simplifier(terms):
and t[1] == "AND"
and normalized_terms not in outer_terms
):
new_terms.append(t)
outer_terms.add(normalized_terms)
new_terms.append(t[0])
new_terms.append(t[2])

if t[0] in outer_terms:
to_remove.add(t[0])

if t[2] in outer_terms:
to_remove.add(t[2])
elif (
Expand Down
1 change: 1 addition & 0 deletions jamesql/rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def simplify_string_query(parser, query, correct_spelling_index=None):
result.transform(tree.copy())

query = simplifier(result.terms)
print(query)
query = " ".join(query).strip()

if len(query.strip()) == 0:
Expand Down

0 comments on commit af6bdc6

Please sign in to comment.