T - model typepublic class StringWordSplitter<T> extends Object implements WordSplitter<T>, SubwordHighlighter
WordSplitter which uses a regular expression to
extract subwords. All string values will be normalized to lower case. Also
normalization of unicode characters to their ASCII value (like ä to a)
is enabled by default.SubwordHighlighter and can
therefore be used for highlighting query words in a model string| Modifier and Type | Class and Description |
|---|---|
static class |
StringWordSplitter.IdentityStringWordSplitter
StringWordSplitter implementation for String models which use the
complete String data as source for the word splitter. |
| Modifier and Type | Field and Description |
|---|---|
static Pattern |
DEFAULT_SUBWORD_PATTERN |
static Pattern |
SIMPLE_TAG_PATTERN |
| Constructor and Description |
|---|
StringWordSplitter(Function<T,String> resolveIndexString)
Create new string word splitter with default subword pattern.
|
StringWordSplitter(Function<T,String> resolveIndexString,
String subwordPattern,
boolean normalizeUnicode)
Create new string word splitter.
|
| Modifier and Type | Method and Description |
|---|---|
HighlightedString |
highlightSubwordPrefixes(String value,
Set<String> queryWords)
Search value String for prefixes in query words and highlight in original
String.
|
HighlightedString |
highlightSubwordPrefixesWithHtml(String value,
Set<String> queryWords)
Search value String (with HTML tags) for prefixes in query words and highlight in original
String.
|
Set<String> |
split(T data)
Split the data of a model to a set of search words that identify the
model for searching in a search index. if null is returned, the model
won't be indexed.
|
public static final Pattern DEFAULT_SUBWORD_PATTERN
public static final Pattern SIMPLE_TAG_PATTERN
public StringWordSplitter(Function<T,String> resolveIndexString)
resolveIndexString - transformation function get get the indexable string from a
model instancepublic StringWordSplitter(Function<T,String> resolveIndexString, String subwordPattern, boolean normalizeUnicode)
resolveIndexString - transformation function get the indexable string from a model
instancesubwordPattern - pattern to identify groups or characters to index as
individual words (if null is given, the default alphanumeric
subword pattern is used)normalizeUnicode - flag, if unicode special characters whould be normalized to
ASCII, if possiblepublic Set<String> split(T data)
WordSplittersplit in interface WordSplitter<T>data - model datapublic HighlightedString highlightSubwordPrefixes(String value, Set<String> queryWords)
SubwordHighlighterhighlightSubwordPrefixes in interface SubwordHighlightervalue - value String to split and transformqueryWords - query words to highlight in prefixespublic HighlightedString highlightSubwordPrefixesWithHtml(String value, Set<String> queryWords)
SubwordHighlighterhighlightSubwordPrefixesWithHtml in interface SubwordHighlightervalue - value HTML String to split and transformqueryWords - query words to highlight in prefixesCopyright © 2015 illucIT Software GmbH. All rights reserved.