Skip to content

Commit

Permalink
Remove prototypey
Browse files Browse the repository at this point in the history
  • Loading branch information
MoessnerFabian(Group) committed Oct 28, 2024
1 parent 25b549e commit d0d9253
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
16 changes: 0 additions & 16 deletions logprep/filter/expression/filter_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,22 +318,6 @@ def does_match(self, document: dict) -> bool:
return self._lower_bound <= value <= self._upper_bound


class LuceneRegexExpression(KeyValueBasedFilterExpression):
"""Lucene compliant filter expression that matches a value using regex."""

def __init__(self, key: List[str], regex: str):
self._regex = regex
self._matcher = re.compile(self._regex)
super().__init__(key, f"/{self._regex.strip('^$')}/")

def does_match(self, document: dict) -> bool:
value = self._get_value(self.key, document)

if isinstance(value, list):
return any(filter(self._matcher.match, value))
return self._matcher.match(str(value)) is not None


class RegExFilterExpression(KeyValueBasedFilterExpression):
"""Filter expression that matches a value using regex."""

Expand Down
5 changes: 0 additions & 5 deletions logprep/filter/lucene_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,8 @@ def _parse_tree(self, tree: luqum.tree) -> FilterExpression:
if self._last_search_field:
return self._create_field_group_expression(tree)
return self._create_value_expression(tree)
if isinstance(tree, Regex):
return self._create_regex_expression(tree)
raise LuceneFilterError(f'The expression "{str(tree)}" is invalid!')

def _create_regex_expression(self, tree: luqum.tree) -> LuceneRegexExpression:
pass

def _create_field_group_expression(self, tree: luqum.tree) -> FilterExpression:
"""Creates filter expression that is resulting from a field group.
Expand Down

0 comments on commit d0d9253

Please sign in to comment.