Package org.apache.nifi.util.search
Interface Search<T>
- All Known Implementing Classes:
AhoCorasick
public interface Search<T>
Defines an interface to search for content given a set of search terms. Any implementation of search must be thread safe.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
initializeDictionary
(Set<SearchTerm<T>> terms) Establishes the dictionary of terms which will be searched in subsequent search calls.search
(InputStream haystack, boolean findAll) Searches the given input stream for matches between the already specified dictionary and the contents scanned.
-
Method Details
-
initializeDictionary
Establishes the dictionary of terms which will be searched in subsequent search calls. This can be called only once- Parameters:
terms
- the terms to create a dictionary of
-
search
Searches the given input stream for matches between the already specified dictionary and the contents scanned.- Parameters:
haystack
- the source data to scan for hitsfindAll
- if true will find all matches if false will find only the first match- Returns:
- SearchState containing results Map might be empty which indicates no matches found but will not be null
- Throws:
IOException
- Thrown for any exceptions occurring while searching.IllegalStateException
- if the dictionary has not yet been initialized
-