Skip to content

Commit

Permalink
Quickfix for lucene regex filter
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-moessner committed Oct 7, 2024
1 parent 2c24452 commit cffe57b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions logprep/filter/lucene_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,13 @@ def recognize_regex_and_add_special_fields(self):
""" Recognize regex expressions in filter and add those fields to regex_fields.
"""
for child in self._tree.children:
value = child.children[0].value[1:-1]
if value.startswith('/') and value.endswith('/'):
self._special_fields['regex_fields'].append(child.name)
child.children[0].value = f'"{value[1:-1]}"'
try:
value = child.children[0].value[1:-1]
if value.startswith('/') and value.endswith('/'):
self._special_fields['regex_fields'].append(child.name)
child.children[0].value = f'"{value[1:-1]}"'
except:
pass

def build_filter(self) -> FilterExpression:
"""Transform luqum tree into FilterExpression
Expand Down

0 comments on commit cffe57b

Please sign in to comment.