public final class CombinedFieldQuery extends Query implements Accountable
Query that treats multiple fields as a single stream and scores terms as if you had
indexed them as a single term in a single field.
The query works as follows:
IndexSearcher.getSimilarity() to score documents.
In order for a similarity to be compatible, Similarity.computeNorm(org.apache.lucene.index.FieldInvertState) must be additive:
the norm of the combined field is the sum of norms for each individual field. The norms must also
be encoded using SmallFloat.intToByte4(int). These requirements hold for all similarities that
compute norms the same way as SimilarityBase.computeNorm(org.apache.lucene.index.FieldInvertState), which includes BM25Similarity and DFRSimilarity. Per-field similarities are not supported.
The scoring is based on BM25F's simple formula described in:
http://www.staff.city.ac.uk/~sb317/papers/foundations_bm25_review.pdf. This query implements the
same approach but allows other similarities besides BM25Similarity.
| 限定符和类型 | 类和说明 |
|---|---|
static class |
CombinedFieldQuery.Builder
A builder for
CombinedFieldQuery. |
NULL_ACCOUNTABLE| 限定符和类型 | 方法和说明 |
|---|---|
Weight |
createWeight(IndexSearcher searcher,
ScoreMode scoreMode,
float boost) |
boolean |
equals(Object other) |
List<Term> |
getTerms() |
int |
hashCode() |
long |
ramBytesUsed() |
Query |
rewrite(IndexReader reader) |
String |
toString(String field) |
void |
visit(QueryVisitor visitor) |
classHash, sameClassAs, toStringgetChildResourcespublic long ramBytesUsed()
ramBytesUsed 在接口中 Accountablepublic Query rewrite(IndexReader reader) throws IOException
rewrite 在类中 QueryIOExceptionpublic void visit(QueryVisitor visitor)
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException
createWeight 在类中 QueryIOExceptionCopyright © 2022. All rights reserved.