prefuse.data.search
Class PrefixSearchTupleSet

java.lang.Object
  extended by prefuse.data.tuple.AbstractTupleSet
      extended by prefuse.data.tuple.DefaultTupleSet
          extended by prefuse.data.search.SearchTupleSet
              extended by prefuse.data.search.PrefixSearchTupleSet
All Implemented Interfaces:
EventConstants, TupleSet

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.

Version:
1.0
Author:
jeffrey heer
See Also:
SearchQueryBinding

Field Summary
 
Fields inherited from class prefuse.data.tuple.DefaultTupleSet
m_tuples
 
Fields inherited from interface prefuse.data.event.EventConstants
ALL_COLUMNS, DELETE, INSERT, UPDATE
 
Fields inherited from interface prefuse.data.tuple.TupleSet
EMPTY_ARRAY
 
Constructor Summary
PrefixSearchTupleSet()
          Creates a new KeywordSearchFocusSet that is not case sensitive.
PrefixSearchTupleSet(boolean caseSensitive)
          Creates a new KeywordSearchFocusSet with the indicated case sensitivity.
 
Method Summary
 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.
 
Methods inherited from class prefuse.data.search.SearchTupleSet
addTuple, index, removeTuple
 
Methods inherited from class prefuse.data.tuple.DefaultTupleSet
addInternal, clearInternal, containsTuple, getTupleCount, removeInternal, setTuple, toArray, tuples
 
Methods inherited from class prefuse.data.tuple.AbstractTupleSet
addColumn, addColumn, addColumn, addColumn, addColumns, addPropertyChangeListener, addPropertyChangeListener, addTupleSetListener, fireTupleEvent, fireTupleEvent, fireTupleEvent, getClientProperty, isAddColumnSupported, putClientProperty, removePropertyChangeListener, removePropertyChangeListener, removeTupleSetListener, tuples, tuples
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrefixSearchTupleSet

public PrefixSearchTupleSet()
Creates a new KeywordSearchFocusSet that is not case sensitive.


PrefixSearchTupleSet

public PrefixSearchTupleSet(boolean caseSensitive)
Creates a new KeywordSearchFocusSet with the indicated case sensitivity.

Parameters:
caseSensitive - true if the search routines should be case sensitive, false otherwise.
Method Detail

getDelimiterString

public java.lang.String getDelimiterString()
Returns the delimiter string used to divide data values and queries into separate words. By default, the value consists of just whitespace characters.

Returns:
the delimiter string used. This is passed as an argument to a StringTokenizer instance that will tokenize the text.
See Also:
StringTokenizer

setDelimiterString

public void setDelimiterString(java.lang.String delim)
Sets the delimiter string used to divide data values and queries into separate words. By default, the delimiter consists of just whitespace characters.

Parameters:
delim - the delimiter string to use. This is passed as an argument to a StringTokenizer instance that will tokenize the text.
See Also:
StringTokenizer

getQuery

public java.lang.String getQuery()
Description copied from class: SearchTupleSet
Returns the current search query, if any.

Specified by:
getQuery in class SearchTupleSet
Returns:
the currently active search query
See Also:
SearchTupleSet.getQuery()

search

public 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. The query string is first broken up into separate terms, as determined by the current delimiter string. A search for each term is conducted, and all matching Tuples are included in the results.

Specified by:
search in class SearchTupleSet
Parameters:
query - the query string to search for.
See Also:
setDelimiterString(String)

index

public void index(Tuple t,
                  java.lang.String field)
Indexes the given field of the provided Tuple instance.

Specified by:
index in class SearchTupleSet
Parameters:
t - the Tuple
field - the data field to index
See Also:
SearchTupleSet.index(prefuse.data.Tuple, java.lang.String)

isUnindexSupported

public boolean isUnindexSupported()
Returns true, as unidexing is supported by this class.

Specified by:
isUnindexSupported in class SearchTupleSet
Returns:
true if unindex is supported, false otherwise.
See Also:
SearchTupleSet.isUnindexSupported()

unindex

public void unindex(Tuple t,
                    java.lang.String field)
Description copied from class: SearchTupleSet
Un-index an individual Tuple field, so that it can no longer be searched for.

Specified by:
unindex in class SearchTupleSet
Parameters:
t - the Tuple
field - the data field to unindex
See Also:
SearchTupleSet.unindex(prefuse.data.Tuple, java.lang.String)

clear

public void clear()
Removes all search hits and clears out the index.

Specified by:
clear in interface TupleSet
Overrides:
clear in class DefaultTupleSet
See Also:
TupleSet.clear()


Copyright © 2007 Regents of the University of California