C# 클래스 Lucene.Net.Queries.CommonTermsQuery

A query that executes high-frequency terms in a optional sub-query to prevent slow queries due to "common" terms like stopwords. This query builds 2 queries off the #add(Term) added terms: low-frequency terms are added to a required boolean clause and high-frequency terms are added to an optional boolean clause. The optional clause is only executed if the required "low-frequency" clause matches. Scores produced by this query will be slightly different than plain BooleanQuery scorer mainly due to differences in the Similarity#coord(int,int) number of leaf queries in the required boolean clause. In most cases, high-frequency terms are unlikely to significantly contribute to the document score unless at least one of the low-frequency terms are matched. This query can improve query execution times significantly if applicable.

CommonTermsQuery has several advantages over stopword filtering at index or query time since a term can be "classified" based on the actual document frequency in the index and can prevent slow queries even across domains without specialized stopword files.

Note: if the query only contains high-frequency terms the query is rewritten into a plain conjunction query ie. all high-frequency terms need to match in order to match a document.

상속: Lucene.Net.Search.Query
파일 보기 프로젝트 열기: paulirwin/lucene.net

보호된 프로퍼티들

프로퍼티 타입 설명
disableCoord bool
highFreqBoost float
highFreqOccur Lucene.Net.Search.BooleanClause.Occur
lowFreqBoost float
lowFreqOccur Lucene.Net.Search.BooleanClause.Occur
maxTermFrequency float
terms IList

공개 메소드들

메소드 설명
Add ( Lucene.Net.Index.Term term ) : void

Adds a term to the CommonTermsQuery

CollectTermContext ( IndexReader reader, IList leaves, TermContext contextArray, Lucene.Net.Index.Term queryTerms ) : void
CommonTermsQuery ( BooleanClause highFreqOccur, BooleanClause lowFreqOccur, float maxTermFrequency ) : System

Creates a new CommonTermsQuery

CommonTermsQuery ( BooleanClause highFreqOccur, BooleanClause lowFreqOccur, float maxTermFrequency, bool disableCoord ) : System

Creates a new CommonTermsQuery

Equals ( object obj ) : bool
ExtractTerms ( ISet terms ) : void
GetHashCode ( ) : int
Rewrite ( IndexReader reader ) : Query
ToString ( string field ) : string

보호된 메소드들

메소드 설명
BuildQuery ( int maxDoc, TermContext contextArray, Lucene.Net.Index.Term queryTerms ) : Query
CalcHighFreqMinimumNumberShouldMatch ( int numOptional ) : int
CalcLowFreqMinimumNumberShouldMatch ( int numOptional ) : int
NewTermQuery ( Lucene.Net.Index.Term term, TermContext context ) : Query

Builds a new TermQuery instance.

This is intended for subclasses that wish to customize the generated queries.

비공개 메소드들

메소드 설명
MinNrShouldMatch ( float minNrShouldMatch, int numOptional ) : int

메소드 상세

Add() 공개 메소드

Adds a term to the CommonTermsQuery
public Add ( Lucene.Net.Index.Term term ) : void
term Lucene.Net.Index.Term /// the term to add
리턴 void

BuildQuery() 보호된 메소드

protected BuildQuery ( int maxDoc, TermContext contextArray, Lucene.Net.Index.Term queryTerms ) : Query
maxDoc int
contextArray Lucene.Net.Index.TermContext
queryTerms Lucene.Net.Index.Term
리턴 Lucene.Net.Search.Query

CalcHighFreqMinimumNumberShouldMatch() 보호된 메소드

protected CalcHighFreqMinimumNumberShouldMatch ( int numOptional ) : int
numOptional int
리턴 int

CalcLowFreqMinimumNumberShouldMatch() 보호된 메소드

protected CalcLowFreqMinimumNumberShouldMatch ( int numOptional ) : int
numOptional int
리턴 int

CollectTermContext() 공개 메소드

public CollectTermContext ( IndexReader reader, IList leaves, TermContext contextArray, Lucene.Net.Index.Term queryTerms ) : void
reader Lucene.Net.Index.IndexReader
leaves IList
contextArray Lucene.Net.Index.TermContext
queryTerms Lucene.Net.Index.Term
리턴 void

CommonTermsQuery() 공개 메소드

Creates a new CommonTermsQuery
/// if is pass as lowFreqOccur or /// highFreqOccur
public CommonTermsQuery ( BooleanClause highFreqOccur, BooleanClause lowFreqOccur, float maxTermFrequency ) : System
highFreqOccur Lucene.Net.Search.BooleanClause /// used for high frequency terms
lowFreqOccur Lucene.Net.Search.BooleanClause /// used for low frequency terms
maxTermFrequency float /// a value in [0..1) (or absolute number >=1) representing the /// maximum threshold of a terms document frequency to be considered a /// low frequency term.
리턴 System

CommonTermsQuery() 공개 메소드

Creates a new CommonTermsQuery
/// if is pass as lowFreqOccur or /// highFreqOccur
public CommonTermsQuery ( BooleanClause highFreqOccur, BooleanClause lowFreqOccur, float maxTermFrequency, bool disableCoord ) : System
highFreqOccur Lucene.Net.Search.BooleanClause /// used for high frequency terms
lowFreqOccur Lucene.Net.Search.BooleanClause /// used for low frequency terms
maxTermFrequency float /// a value in [0..1) (or absolute number >=1) representing the /// maximum threshold of a terms document frequency to be considered a /// low frequency term.
disableCoord bool /// disables in scoring for the low /// / high frequency sub-queries
리턴 System

Equals() 공개 메소드

public Equals ( object obj ) : bool
obj object
리턴 bool

ExtractTerms() 공개 메소드

public ExtractTerms ( ISet terms ) : void
terms ISet
리턴 void

GetHashCode() 공개 메소드

public GetHashCode ( ) : int
리턴 int

NewTermQuery() 보호된 메소드

Builds a new TermQuery instance.

This is intended for subclasses that wish to customize the generated queries.

protected NewTermQuery ( Lucene.Net.Index.Term term, TermContext context ) : Query
term Lucene.Net.Index.Term term
context Lucene.Net.Index.TermContext the TermContext to be used to create the low level term query. Can be null.
리턴 Lucene.Net.Search.Query

Rewrite() 공개 메소드

public Rewrite ( IndexReader reader ) : Query
reader Lucene.Net.Index.IndexReader
리턴 Lucene.Net.Search.Query

ToString() 공개 메소드

public ToString ( string field ) : string
field string
리턴 string

프로퍼티 상세

disableCoord 보호되어 있는 프로퍼티

protected bool disableCoord
리턴 bool

highFreqBoost 보호되어 있는 프로퍼티

protected float highFreqBoost
리턴 float

highFreqOccur 보호되어 있는 프로퍼티

protected BooleanClause.Occur,Lucene.Net.Search highFreqOccur
리턴 Lucene.Net.Search.BooleanClause.Occur

lowFreqBoost 보호되어 있는 프로퍼티

protected float lowFreqBoost
리턴 float

lowFreqOccur 보호되어 있는 프로퍼티

protected BooleanClause.Occur,Lucene.Net.Search lowFreqOccur
리턴 Lucene.Net.Search.BooleanClause.Occur

maxTermFrequency 보호되어 있는 프로퍼티

protected float maxTermFrequency
리턴 float

terms 보호되어 있는 프로퍼티

protected IList terms
리턴 IList