Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
Classes | Public Member Functions | Properties | List of all members
Lucene.Net.Search.PhraseQuery Class Reference

A Query that matches documents containing a particular sequence of terms. A PhraseQuery is built by QueryParser for input like "new york". More...

Inherits Lucene.Net.Search.Query.

Public Member Functions

 PhraseQuery ()
 Constructs an empty phrase query.
 
virtual void Add (Term term)
 Adds a term to the end of the query phrase. The relative position of the term is the one immediately after the last term added.
 
virtual void Add (Term term, int position)
 Adds a term to the end of the query phrase. The relative position of the term within the phrase is specified explicitly. This allows e.g. phrases with more than one term at the same position or phrases with gaps (e.g. in connection with stopwords).
 
virtual Term[] GetTerms ()
 Returns the set of terms in this phrase.
 
virtual int[] GetPositions ()
 Returns the relative positions of terms in this phrase.
 
override Weight CreateWeight (Searcher searcher)
 Expert: Constructs an appropriate Weight implementation for this query.
 
override void ExtractTerms (System.Collections.Generic.ISet< Term > queryTerms)
 
override System.String ToString (System.String f)
 Prints a user-readable version of this query.
 
override bool Equals (System.Object o)
 Returns true iff o is equal to this.
 
override int GetHashCode ()
 Returns a hash code value for this object.
 
- Public Member Functions inherited from Lucene.Net.Search.Query
override System.String ToString ()
 Prints a query to a string.
 
virtual Weight Weight (Searcher searcher)
 Expert: Constructs and initializes a Weight for a top-level query.
 
virtual Query Rewrite (IndexReader reader)
 Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
 
virtual Query Combine (Query[] queries)
 Expert: called when re-writing queries under MultiSearcher.
 
virtual Similarity GetSimilarity (Searcher searcher)
 Expert: Returns the Similarity implementation to be used for this query. Subclasses may override this method to specify their own Similarity implementation, perhaps one that delegates through that of the Searcher. By default the Searcher's Similarity implementation is returned.
 
virtual System.Object Clone ()
 Returns a clone of this query.
 
override int GetHashCode ()
 
override bool Equals (System.Object obj)
 

Properties

virtual int Slop [get, set]
 Sets the number of other words permitted between words in query phrase. If zero, then this is an exact phrase search. For larger values this works like a WITHIN or NEAR operator. The slop is in fact an edit-distance, where the units correspond to moves of terms in the query phrase out of position. For example, to switch the order of two words requires two moves (the first move places the words atop one another), so to permit re-orderings of phrases, the slop must be at least two. More exact matches are scored higher than sloppier matches, thus search results are sorted by exactness. The slop is zero by default, requiring exact matches.
 
- Properties inherited from Lucene.Net.Search.Query
virtual float Boost [get, set]
 Gets or sets the boost for this query clause to b. Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b. The boost is 1.0 by default.
 

Additional Inherited Members

- Static Public Member Functions inherited from Lucene.Net.Search.Query
static Query MergeBooleanQueries (params BooleanQuery[] queries)
 Expert: merges the clauses of a set of BooleanQuery's into a single BooleanQuery.
 

Detailed Description

A Query that matches documents containing a particular sequence of terms. A PhraseQuery is built by QueryParser for input like "new york".

This query may be combined with other terms or queries with a BooleanQuery.

Definition at line 35 of file PhraseQuery.cs.

Constructor & Destructor Documentation

Lucene.Net.Search.PhraseQuery.PhraseQuery ( )

Constructs an empty phrase query.

Definition at line 44 of file PhraseQuery.cs.

Member Function Documentation

virtual void Lucene.Net.Search.PhraseQuery.Add ( Term  term)
virtual

Adds a term to the end of the query phrase. The relative position of the term is the one immediately after the last term added.

Definition at line 69 of file PhraseQuery.cs.

virtual void Lucene.Net.Search.PhraseQuery.Add ( Term  term,
int  position 
)
virtual

Adds a term to the end of the query phrase. The relative position of the term within the phrase is specified explicitly. This allows e.g. phrases with more than one term at the same position or phrases with gaps (e.g. in connection with stopwords).

Parameters
term
position

Definition at line 88 of file PhraseQuery.cs.

override Weight Lucene.Net.Search.PhraseQuery.CreateWeight ( Searcher  searcher)
virtual

Expert: Constructs an appropriate Weight implementation for this query.

Only implemented by primitive queries, which re-write to themselves.

Reimplemented from Lucene.Net.Search.Query.

Definition at line 280 of file PhraseQuery.cs.

override bool Lucene.Net.Search.PhraseQuery.Equals ( System.Object  o)

Returns true iff o is equal to this.

Definition at line 356 of file PhraseQuery.cs.

override void Lucene.Net.Search.PhraseQuery.ExtractTerms ( System.Collections.Generic.ISet< Term queryTerms)
virtual
See Also
Lucene.Net.Search.Query.ExtractTerms(System.Collections.Generic.ISet{Term})

Reimplemented from Lucene.Net.Search.Query.

Definition at line 295 of file PhraseQuery.cs.

override int Lucene.Net.Search.PhraseQuery.GetHashCode ( )

Returns a hash code value for this object.

Definition at line 365 of file PhraseQuery.cs.

virtual int [] Lucene.Net.Search.PhraseQuery.GetPositions ( )
virtual

Returns the relative positions of terms in this phrase.

Definition at line 110 of file PhraseQuery.cs.

virtual Term [] Lucene.Net.Search.PhraseQuery.GetTerms ( )
virtual

Returns the set of terms in this phrase.

Definition at line 104 of file PhraseQuery.cs.

override System.String Lucene.Net.Search.PhraseQuery.ToString ( System.String  f)
virtual

Prints a user-readable version of this query.

Implements Lucene.Net.Search.Query.

Definition at line 301 of file PhraseQuery.cs.

Property Documentation

virtual int Lucene.Net.Search.PhraseQuery.Slop
getset

Sets the number of other words permitted between words in query phrase. If zero, then this is an exact phrase search. For larger values this works like a WITHIN or NEAR operator. The slop is in fact an edit-distance, where the units correspond to moves of terms in the query phrase out of position. For example, to switch the order of two words requires two moves (the first move places the words atop one another), so to permit re-orderings of phrases, the slop must be at least two. More exact matches are scored higher than sloppier matches, thus search results are sorted by exactness. The slop is zero by default, requiring exact matches.

Definition at line 61 of file PhraseQuery.cs.


The documentation for this class was generated from the following file: