| Constructor and Description |
|---|
AhoCorasick()
Constructs a new search object.
|
| Modifier and Type | Method and Description |
|---|---|
private Node |
addMatch(SearchTerm<T> term,
int offset,
Node current) |
private void |
initialize() |
void |
initializeDictionary(Set<SearchTerm<T>> terms)
Establishes the dictionary of terms which will be searched in subsequent search calls.
|
SearchState |
search(InputStream stream,
boolean findAll)
Searches the given input stream for matches between the already specified dictionary and the contents scanned.
|
private SearchState |
search(InputStream stream,
boolean findAll,
SearchState state) |
private Node root
public AhoCorasick()
IllegalArgumentException - if given terms are null or emptypublic void initializeDictionary(Set<SearchTerm<T>> terms)
SearchinitializeDictionary in interface Search<T>terms - the terms to create a dictionary ofprivate Node addMatch(SearchTerm<T> term, int offset, Node current)
private void initialize()
public SearchState search(InputStream stream, boolean findAll) throws IOException
Searchsearch in interface Search<T>stream - the source data to scan for hitsfindAll - if true will find all matches if false will find only the first matchIOException - Thrown for any exceptions occurring while searching.private SearchState search(InputStream stream, boolean findAll, SearchState state) throws IOException
IOExceptionCopyright © 2023 Apache NiFi Project. All rights reserved.