public class KeywordSearchTupleSet extends SearchTupleSet
SearchTupleSet implementation that performs text searches on indexed Tuple data using the Lucene search engine. Lucene is an open source search engine supporting full text indexing and keyword search. Please refer to the Lucene web page for more information. Note that for this class to be used by prefuse applications, the Lucene classes must be included on the application classpath.
SearchQueryBinding| Modifier and Type | Field and Description |
|---|---|
protected int |
m_id |
protected LuceneSearcher |
m_lucene |
protected IntObjectHashMap |
m_map |
protected java.lang.String |
m_query |
protected boolean |
m_storeTermVectors |
m_tuplesALL_COLUMNS, DELETE, INSERT, UPDATEEMPTY_ARRAY| Constructor and Description |
|---|
KeywordSearchTupleSet()
Creates a new KeywordSearchFocusSet using an in-memory search index.
|
KeywordSearchTupleSet(LuceneSearcher searcher)
Creates a new TextSearchFocusSet with the given LuceneSearcher.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all search hits and clears out the index.
|
protected org.apache.lucene.document.Document |
getDocument(int id,
java.lang.String text)
Create a Lucene Document instance with the given document ID and text.
|
LuceneSearcher |
getLuceneSearcher()
Get the
LuceneSearcher instance used by this class. |
protected Tuple |
getMatchingTuple(org.apache.lucene.document.Document d)
Return the Tuple matching the given Lucene Document, if any.
|
java.lang.String |
getQuery()
Returns the current search query, if any.
|
IntObjectHashMap |
getTupleMap()
Returns a copy of the mapping from Lucene document IDs to prefuse Tuple instances.
|
void |
index(Tuple t,
java.lang.String field)
Index an individual Tuple field, so that it can be searched for.
|
boolean |
isUnindexSupported()
Returns false, as un-indexing values is not currently supported.
|
void |
search(java.lang.String query)
Searches the indexed Tuple fields for matching keywords, using
the Lucene search engine.
|
void |
unindex(Tuple t,
java.lang.String attrName)
This method throws an exception, as un-idexing is not supported.
|
addTuple, index, removeTupleaddInternal, clearInternal, containsTuple, getTupleCount, removeInternal, setTuple, toArray, tuplesaddColumn, addColumn, addColumn, addColumn, addColumns, addPropertyChangeListener, addPropertyChangeListener, addTupleSetListener, fireTupleEvent, fireTupleEvent, fireTupleEvent, getClientProperty, isAddColumnSupported, putClientProperty, removePropertyChangeListener, removePropertyChangeListener, removeTupleSetListener, tuples, tuplesprotected IntObjectHashMap m_map
protected java.lang.String m_query
protected LuceneSearcher m_lucene
protected boolean m_storeTermVectors
protected int m_id
public KeywordSearchTupleSet()
public KeywordSearchTupleSet(LuceneSearcher searcher)
searcher - the LuceneSearcher to use.public java.lang.String getQuery()
getQuery in class SearchTupleSetpublic void search(java.lang.String query)
search in class SearchTupleSetquery - the query string to search forprotected Tuple getMatchingTuple(org.apache.lucene.document.Document d)
d - the Document to lookup.public void index(Tuple t, java.lang.String field)
SearchTupleSetindex in class SearchTupleSett - the Tuplefield - the data field to indexSearchTupleSet.index(prefuse.data.Tuple, java.lang.String)public boolean isUnindexSupported()
isUnindexSupported in class SearchTupleSetSearchTupleSet.isUnindexSupported()public void unindex(Tuple t, java.lang.String attrName)
unindex in class SearchTupleSett - the TupleattrName - the data field to unindexjava.lang.UnsupportedOperationExceptionSearchTupleSet.unindex(prefuse.data.Tuple, java.lang.String)protected org.apache.lucene.document.Document getDocument(int id,
java.lang.String text)
id - the document IDtext - the text the Document should containpublic LuceneSearcher getLuceneSearcher()
LuceneSearcher instance used by this class.public IntObjectHashMap getTupleMap()
public void clear()
clear in interface TupleSetclear in class DefaultTupleSetTupleSet.clear()