org.neo4j.index.lucene
Class LuceneFulltextQueryIndexService
java.lang.Object
org.neo4j.index.impl.GenericIndexService
org.neo4j.index.lucene.LuceneIndexService
org.neo4j.index.lucene.LuceneFulltextIndexService
org.neo4j.index.lucene.LuceneFulltextQueryIndexService
- All Implemented Interfaces:
- IndexService
public class LuceneFulltextQueryIndexService
- extends LuceneFulltextIndexService
A LuceneFulltextIndexService
which treats the value in
getNodes(String, Object)
as a Lucene query, given in the
Lucene query syntax.
See more information at http://wiki.neo4j.org/content/Indexing_with_IndexService#A_great_subclass_to_LuceneFulltextIndexService
Method Summary |
protected org.apache.lucene.search.Query |
formQuery(String key,
Object value)
|
org.apache.lucene.queryParser.QueryParser.Operator |
getDefaultQueryOperator(String key,
Object value)
Returns the default operator (AND or OR) used when parsing the query. |
IndexHits<Node> |
getNodes(String key,
Object value)
Here the value is treated as a lucene query,
http://lucene.apache.org/java/2_9_1/queryparsersyntax.html
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:
"andy" --> (1)
"Andy" --> (1)
"wachowski" --> (1), (2)
"+wachow* +larry" --> (2)
"andy AND larry" -->
"andy OR larry" --> (1), (2)
"larry Wachowski" --> (1), (2)
The default AND/OR behaviour can be changed by overriding
getDefaultQueryOperator(String, Object) . |
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 |
LuceneFulltextQueryIndexService
public LuceneFulltextQueryIndexService(GraphDatabaseService graphDb)
- Parameters:
graphDb
- the GraphDatabaseService
to use.
formQuery
protected org.apache.lucene.search.Query formQuery(String key,
Object value)
- Overrides:
formQuery
in class LuceneFulltextIndexService
getDefaultQueryOperator
public org.apache.lucene.queryParser.QueryParser.Operator getDefaultQueryOperator(String key,
Object value)
- Returns the default operator (AND or OR) used when parsing the query.
See more information at http://lucene.apache.org
- Parameters:
key
- the index key.value
- the lucene query.
- Returns:
- the default operator (AND or OR ) used when parsing the query.
getNodes
public IndexHits<Node> getNodes(String key,
Object value)
- Here the
value
is treated as a lucene query,
http://lucene.apache.org/java/2_9_1/queryparsersyntax.html
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:
- "andy" --> (1)
- "Andy" --> (1)
- "wachowski" --> (1), (2)
- "+wachow* +larry" --> (2)
- "andy AND larry" -->
- "andy OR larry" --> (1), (2)
- "larry Wachowski" --> (1), (2)
The default AND/OR behaviour can be changed by overriding
getDefaultQueryOperator(String, Object)
.
- Specified by:
getNodes
in interface IndexService
- Overrides:
getNodes
in class LuceneFulltextIndexService
- Parameters:
key
- the key for indexvalue
- the value for index
- Returns:
- nodes that have been indexed with key and value
Copyright © 2010 Neo4j. All Rights Reserved.