Method Search
Search(Query, Int32)
Finds the top n
hits for query
.
Declaration
[TargetMethod("Search", 1)]
public virtual TopDocs Search(Query query, int n)
Parameters
Type | Name | Description |
---|---|---|
Query | query | |
System.Int32 | n |
Returns
Type | Description |
---|---|
TopDocs |
Exceptions
Type | Condition |
---|---|
BooleanQuery.TooManyClausesException | If a query would exceed MaxClauseCount clauses. |
Search(Query, Filter, Int32)
Finds the top n
hits for query
, applying filter
if non-null.
Declaration
[TargetMethod("Search", 2)]
public virtual TopDocs Search(Query query, Filter filter, int n)
Parameters
Type | Name | Description |
---|---|---|
Query | query | |
Filter | filter | |
System.Int32 | n |
Returns
Type | Description |
---|---|
TopDocs |
Exceptions
Type | Condition |
---|---|
BooleanQuery.TooManyClausesException | If a query would exceed MaxClauseCount clauses. |
Search(Query, Filter, ICollector)
Lower-level search API.
Collect(Int32) is called for every matching document.
Declaration
[TargetMethod("Search", 3)]
public virtual void Search(Query query, Filter filter, ICollector results)
Parameters
Type | Name | Description |
---|---|---|
Query | query | To match documents |
Filter | filter | Ef non-null, used to permit documents to be collected. |
ICollector | results | To receive hits |
Exceptions
Type | Condition |
---|---|
BooleanQuery.TooManyClausesException | If a query would exceed MaxClauseCount clauses. |
Search(Query, ICollector)
Lower-level search API.
Collect(Int32) is called for every matching document.
Declaration
[TargetMethod("Search", 4)]
public virtual void Search(Query query, ICollector results)
Parameters
Type | Name | Description |
---|---|---|
Query | query | |
ICollector | results |
Exceptions
Type | Condition |
---|---|
BooleanQuery.TooManyClausesException | If a query would exceed MaxClauseCount clauses. |
Search(Query, Filter, Int32, Sort)
Search implementation with arbitrary sorting. Finds
the top n
hits for query
, applying
filter
if non-null, and sorting the hits by the criteria in
sort
.
NOTE: this does not compute scores by default; use Search(Query, Filter, Int32, Sort, Boolean, Boolean) to control scoring.
Declaration
[TargetMethod("Search", 5)]
public virtual TopFieldDocs Search(Query query, Filter filter, int n, Sort sort)
Parameters
Type | Name | Description |
---|---|---|
Query | query | |
Filter | filter | |
System.Int32 | n | |
Sort | sort |
Returns
Type | Description |
---|---|
TopFieldDocs |
Exceptions
Type | Condition |
---|---|
BooleanQuery.TooManyClausesException | If a query would exceed MaxClauseCount clauses. |
Search(Query, Filter, Int32, Sort, Boolean, Boolean)
Search implementation with arbitrary sorting, plus
control over whether hit scores and max score
should be computed. Finds
the top n
hits for query
, applying
filter
if non-null, and sorting the hits by the criteria in
sort
. If doDocScores
is true
then the score of each hit will be computed and
returned. If doMaxScore
is
true
then the maximum score over all
collected hits will be computed.
Declaration
[TargetMethod("Search", 6)]
public virtual TopFieldDocs Search(Query query, Filter filter, int n, Sort sort, bool doDocScores, bool doMaxScore)
Parameters
Type | Name | Description |
---|---|---|
Query | query | |
Filter | filter | |
System.Int32 | n | |
Sort | sort | |
System.Boolean | doDocScores | |
System.Boolean | doMaxScore |
Returns
Type | Description |
---|---|
TopFieldDocs |
Exceptions
Type | Condition |
---|---|
BooleanQuery.TooManyClausesException | If a query would exceed MaxClauseCount clauses. |
Search(Query, Int32, Sort)
Search implementation with arbitrary sorting and no filter.
Declaration
[TargetMethod("Search", 7)]
public virtual TopFieldDocs Search(Query query, int n, Sort sort)
Parameters
Type | Name | Description |
---|---|---|
Query | query | The query to search for |
System.Int32 | n | Return only the top n results |
Sort | sort | The Sort object |
Returns
Type | Description |
---|---|
TopFieldDocs | The top docs, sorted according to the supplied Sort instance |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | if there is a low-level I/O error |
Search(Weight, ScoreDoc, Int32)
Expert: Low-level search implementation. Finds the top nDocs
hits for query
, applying filter
if non-null.
Applications should usually call Search(Query, Int32) or Search(Query, Filter, Int32) instead.
Declaration
[TargetMethod("Search", 8)]
protected virtual TopDocs Search(Weight weight, ScoreDoc after, int nDocs)
Parameters
Type | Name | Description |
---|---|---|
Weight | weight | |
ScoreDoc | after | |
System.Int32 | nDocs |
Returns
Type | Description |
---|---|
TopDocs |
Exceptions
Type | Condition |
---|---|
BooleanQuery.TooManyClausesException | If a query would exceed MaxClauseCount clauses. |
Search(IList<AtomicReaderContext>, Weight, ScoreDoc, Int32)
Expert: Low-level search implementation. Finds the top
n
hits for query
.
Applications should usually call Search(Query, Int32) or Search(Query, Filter, Int32) instead.
Declaration
[TargetMethod("Search", 9)]
protected virtual TopDocs Search(IList<AtomicReaderContext> leaves, Weight weight, ScoreDoc after, int nDocs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<AtomicReaderContext> | leaves | |
Weight | weight | |
ScoreDoc | after | |
System.Int32 | nDocs |
Returns
Type | Description |
---|---|
TopDocs |
Exceptions
Type | Condition |
---|---|
BooleanQuery.TooManyClausesException | If a query would exceed MaxClauseCount clauses. |
Search(Weight, Int32, Sort, Boolean, Boolean)
Expert: Low-level search implementation with arbitrary
sorting and control over whether hit scores and max
score should be computed. Finds
the top nDocs
hits for query
and sorting the hits
by the criteria in sort
.
Applications should usually call Search(Query, Filter, Int32, Sort) instead.
Declaration
[TargetMethod("Search", 10)]
protected virtual TopFieldDocs Search(Weight weight, int nDocs, Sort sort, bool doDocScores, bool doMaxScore)
Parameters
Type | Name | Description |
---|---|---|
Weight | weight | |
System.Int32 | nDocs | |
Sort | sort | |
System.Boolean | doDocScores | |
System.Boolean | doMaxScore |
Returns
Type | Description |
---|---|
TopFieldDocs |
Exceptions
Type | Condition |
---|---|
BooleanQuery.TooManyClausesException | If a query would exceed MaxClauseCount clauses. |
Search(Weight, FieldDoc, Int32, Sort, Boolean, Boolean, Boolean)
Just like Search(Weight, Int32, Sort, Boolean, Boolean), but you choose
whether or not the fields in the returned FieldDoc instances should
be set by specifying fillFields
.
Declaration
[TargetMethod("Search", 11)]
protected virtual TopFieldDocs Search(Weight weight, FieldDoc after, int nDocs, Sort sort, bool fillFields, bool doDocScores, bool doMaxScore)
Parameters
Type | Name | Description |
---|---|---|
Weight | weight | |
FieldDoc | after | |
System.Int32 | nDocs | |
Sort | sort | |
System.Boolean | fillFields | |
System.Boolean | doDocScores | |
System.Boolean | doMaxScore |
Returns
Type | Description |
---|---|
TopFieldDocs |
Search(IList<AtomicReaderContext>, Weight, FieldDoc, Int32, Sort, Boolean, Boolean, Boolean)
Just like Search(Weight, Int32, Sort, Boolean, Boolean), but you choose
whether or not the fields in the returned FieldDoc instances should
be set by specifying fillFields
.
Declaration
[TargetMethod("Search", 12)]
protected virtual TopFieldDocs Search(IList<AtomicReaderContext> leaves, Weight weight, FieldDoc after, int nDocs, Sort sort, bool fillFields, bool doDocScores, bool doMaxScore)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<AtomicReaderContext> | leaves | |
Weight | weight | |
FieldDoc | after | |
System.Int32 | nDocs | |
Sort | sort | |
System.Boolean | fillFields | |
System.Boolean | doDocScores | |
System.Boolean | doMaxScore |
Returns
Type | Description |
---|---|
TopFieldDocs |
Search(IList<AtomicReaderContext>, Weight, ICollector)
Lower-level search API.
Collect(Int32) is called for every document.
NOTE: this method executes the searches on all given leaves exclusively. To search across all the searchers leaves use m_leafContexts.
Declaration
protected virtual void Search(IList<AtomicReaderContext> leaves, Weight weight, ICollector collector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<AtomicReaderContext> | leaves | The searchers leaves to execute the searches on |
Weight | weight | To match documents |
ICollector | collector | To receive hits |
Exceptions
Type | Condition |
---|---|
BooleanQuery.TooManyClausesException | If a query would exceed MaxClauseCount clauses. |