public class PrefixSearchTupleSet extends SearchTupleSet
SearchTupleSet implementation supporting word prefix searches over indexed
Tuple data fields. This class uses a Trie
data structure
to find search results quickly; however, only prefix matches will be
identified as valid search matches. Multi-term search queries will result
in the union of the results for the individual query terms. That is, Tuples
that match any one of the terms will be included in the results.
For more advanced search capabilities, see
KeywordSearchTupleSet
or RegexSearchTupleSet
.
SearchQueryBinding
m_tuples
ALL_COLUMNS, DELETE, INSERT, UPDATE
EMPTY_ARRAY
Constructor and Description |
---|
PrefixSearchTupleSet()
Creates a new KeywordSearchFocusSet that is not case sensitive.
|
PrefixSearchTupleSet(boolean caseSensitive)
Creates a new KeywordSearchFocusSet with the indicated case sensitivity.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all search hits and clears out the index.
|
java.lang.String |
getDelimiterString()
Returns the delimiter string used to divide data values and
queries into separate words.
|
java.lang.String |
getQuery()
Returns the current search query, if any.
|
void |
index(Tuple t,
java.lang.String field)
Indexes the given field of the provided Tuple instance.
|
boolean |
isUnindexSupported()
Returns true, as unidexing is supported by this class.
|
void |
search(java.lang.String query)
Searches the indexed Tuple fields for matching string prefixes,
adding the Tuple instances for each search match to this TupleSet.
|
void |
setDelimiterString(java.lang.String delim)
Sets the delimiter string used to divide data values and
queries into separate words.
|
void |
unindex(Tuple t,
java.lang.String field)
Un-index an individual Tuple field, so that it can no longer be
searched for.
|
addTuple, index, removeTuple
addInternal, clearInternal, containsTuple, getTupleCount, removeInternal, setTuple, toArray, tuples
addColumn, addColumn, addColumn, addColumn, addColumns, addPropertyChangeListener, addPropertyChangeListener, addTupleSetListener, fireTupleEvent, fireTupleEvent, fireTupleEvent, getClientProperty, isAddColumnSupported, putClientProperty, removePropertyChangeListener, removePropertyChangeListener, removeTupleSetListener, tuples, tuples
public PrefixSearchTupleSet()
public PrefixSearchTupleSet(boolean caseSensitive)
caseSensitive
- true if the search routines should be case
sensitive, false otherwise.public java.lang.String getDelimiterString()
StringTokenizer
instance that will tokenize the text.StringTokenizer
public void setDelimiterString(java.lang.String delim)
delim
- the delimiter string to use. This is passed as an argument
to a StringTokenizer
instance that will tokenize the
text.StringTokenizer
public java.lang.String getQuery()
SearchTupleSet
getQuery
in class SearchTupleSet
SearchTupleSet.getQuery()
public void search(java.lang.String query)
search
in class SearchTupleSet
query
- the query string to search for.setDelimiterString(String)
public void index(Tuple t, java.lang.String field)
index
in class SearchTupleSet
t
- the Tuplefield
- the data field to indexSearchTupleSet.index(prefuse.data.Tuple, java.lang.String)
public boolean isUnindexSupported()
isUnindexSupported
in class SearchTupleSet
SearchTupleSet.isUnindexSupported()
public void unindex(Tuple t, java.lang.String field)
SearchTupleSet
unindex
in class SearchTupleSet
t
- the Tuplefield
- the data field to unindexSearchTupleSet.unindex(prefuse.data.Tuple, java.lang.String)
public void clear()
clear
in interface TupleSet
clear
in class DefaultTupleSet
TupleSet.clear()
Copyright ? 2013 Regents of the University of California