|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.neo4j.index.lucene.QueryContext
public class QueryContext
This class has the extra query configuration to use
with Index.query(Object)
and Index.query(String, Object)
.
It allows a query to have sorting, default operators, and allows the engine
to turn of searching of modifications made inside a transaction,
to gain performance.
Constructor Summary | |
---|---|
QueryContext(Object queryOrQueryObject)
|
Method Summary | |
---|---|
QueryContext |
defaultOperator(org.apache.lucene.queryParser.QueryParser.Operator defaultOperator)
Lucenes default operator is OR. |
org.apache.lucene.queryParser.QueryParser.Operator |
getDefaultOperator()
|
Object |
getQueryOrQueryObject()
|
org.apache.lucene.search.Sort |
getSorting()
|
int |
getTop()
|
boolean |
getTradeCorrectnessForSpeed()
|
QueryContext |
sort(org.apache.lucene.search.Sort sorting)
Returns a QueryContext with sorting added to it. |
QueryContext |
sort(String key,
String... additionalKeys)
Returns a QueryContext with sorting added to it. |
QueryContext |
sortByScore()
|
QueryContext |
top(int numberOfTopHits)
Makes use of Searcher.search(org.apache.lucene.search.Query, int) ,
alt. |
QueryContext |
tradeCorrectnessForSpeed()
Adding to or removing from an index affects results from query methods inside the same transaction, even before those changes are committed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueryContext(Object queryOrQueryObject)
Method Detail |
---|
public Object getQueryOrQueryObject()
public QueryContext sort(org.apache.lucene.search.Sort sorting)
sorting
- The sorting to be used
public QueryContext sort(String key, String... additionalKeys)
key
- The key to sort on.additionalKeys
- Any additional keys to sort on.
public QueryContext sortByScore()
public org.apache.lucene.search.Sort getSorting()
sort(Sort)
or sortByScore()
public QueryContext defaultOperator(org.apache.lucene.queryParser.QueryParser.Operator defaultOperator)
defaultOperator
- The new operator to use.
public org.apache.lucene.queryParser.QueryParser.Operator getDefaultOperator()
QueryParser.Operator
specified with #defaultOperator(Operator)
or "OR" if none specified.public QueryContext tradeCorrectnessForSpeed()
public boolean getTradeCorrectnessForSpeed()
tradeCorrectnessForSpeed()
has been called.public QueryContext top(int numberOfTopHits)
Searcher.search(org.apache.lucene.search.Query, int)
,
alt. Searcher.search(org.apache.lucene.search.Query, org.apache.lucene.search.Filter, int, Sort)
where only the top numberOfTopHits
hits are returned. Default
behavior is to return all hits, although lazily retrieved from lucene all
the way up to the IndexHits
iterator.
numberOfTopHits
- the maximum number of top hits to return.
QueryContext
with the number of top hits set.public int getTop()
top(int)
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |