redirectory.libs_int.hyperscan.search_context module

class redirectory.libs_int.hyperscan.search_context.SearchContext(original: str, **kwargs)[source]

Bases: dict

handle_match(destination_id: int, from_index: int, to_index: int)[source]

Handles a hyperscan matched passed from the match_event_handler. If the length of the match matches the length of the original search query it will be added to the matched_ids.

Parameters:
  • destination_id – the id of the matched expression from Hyperscan
  • from_index – from where the match starts
  • to_index – until where the match ends
is_empty()[source]

Checks in any matches have been found associated with this context

Returns:a boolean representing if any matches are found
matched_ids = None
original = None