org.neo4j.index.lucene
Class LuceneFulltextIndexService
java.lang.Object
org.neo4j.index.impl.GenericIndexService
org.neo4j.index.lucene.LuceneIndexService
org.neo4j.index.lucene.LuceneFulltextIndexService
- All Implemented Interfaces:
- IndexService
- Direct Known Subclasses:
- LuceneFulltextQueryIndexService
public class LuceneFulltextIndexService
- extends LuceneIndexService
A LuceneIndexService
which indexes the values with fulltext indexing.
Fulltext means that the indexing process takes the values you throw in and
tokenizes those into words so that you can query for those individual words
in getNodes(String, Object)
. Also queries are case-insensitive.
It stores more data per Lucene entry to make this possible. This makes it
incompatible with LuceneIndexService
so it has got its own XA
resource ID. This means that you can have one LuceneIndexService
and
one LuceneFulltextIndexService
for a GraphDatabaseService
.
See more information at
http://wiki.neo4j.org/content/Indexing_with_IndexService#Fulltext_indexing
Methods inherited from class org.neo4j.index.impl.GenericIndexService |
beginTx, getGraphDb, getQueue, removeIndex, setIsolation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DOC_INDEX_SOURCE_KEY
protected static final String DOC_INDEX_SOURCE_KEY
- See Also:
- Constant Field Values
FULLTEXT_DIR_NAME_POSTFIX
protected static final String FULLTEXT_DIR_NAME_POSTFIX
- See Also:
- Constant Field Values
LuceneFulltextIndexService
public LuceneFulltextIndexService(GraphDatabaseService graphDb)
- Parameters:
graphDb
- the GraphDatabaseService
to use.
getDataSourceClass
protected Class<? extends LuceneDataSource> getDataSourceClass()
- Overrides:
getDataSourceClass
in class LuceneIndexService
getDirName
protected String getDirName()
- Overrides:
getDirName
in class LuceneIndexService
getXaResourceId
protected byte[] getXaResourceId()
- Overrides:
getXaResourceId
in class LuceneIndexService
getNodes
public IndexHits<Node> getNodes(String key,
Object value)
- Since this is a "fulltext" index it changes the contract of this method
slightly. It treats the
value
more like a query in than you can
query for individual words in your indexed values.
So if you've indexed node (1) with value "Andy Wachowski" and node (2)
with "Larry Wachowski" you can expect this behaviour if you query for:
- "addy" --> (1)
- "Andy" --> (1)
- "wachowski" --> (1), (2)
- "andy larry" -->
- "larry Wachowski" --> (2)
- "wachowski Andy" --> (1)
- Specified by:
getNodes
in interface IndexService
- Overrides:
getNodes
in class LuceneIndexService
- Parameters:
key
- the key for indexvalue
- the value for index
- Returns:
- nodes that have been indexed with key and value
formQuery
protected org.apache.lucene.search.Query formQuery(String key,
Object value)
- Overrides:
formQuery
in class LuceneIndexService
enableCache
public void enableCache(String key,
int maxNumberOfCachedEntries)
- Description copied from class:
LuceneIndexService
- Enables an LRU cache for a specific index (specified by
key
) so
that the maxNumberOfCachedEntries
number of results found with
LuceneIndexService.getNodes(String, Object)
are cached for faster consecutive
lookups. It's preferred to enable cache at construction time.
- Overrides:
enableCache
in class LuceneIndexService
- Parameters:
key
- the index to enable cache for.maxNumberOfCachedEntries
- the max size of the cache before old ones
are flushed from the cache.
Copyright © 2010 Neo4j. All Rights Reserved.