Class PrefixQuery
A Query that matches documents containing terms with a specified prefix. A PrefixQuery
is built by QueryParser for input like app*.
Inherited Members
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public class PrefixQuery : MultiTermQuery
Constructors
PrefixQuery(Term)
Constructs a query for terms starting with prefix.
Declaration
public PrefixQuery(Term prefix)
Parameters
| Type | Name | Description |
|---|---|---|
| Term | prefix |
Properties
Prefix
Returns the prefix of this query.
Declaration
public virtual Term Prefix { get; }
Property Value
| Type | Description |
|---|---|
| Term |
Methods
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current object. |
Overrides
GetTermsEnum(Terms, AttributeSource)
Construct the enumeration to be used, expanding the pattern term. this method should only be called if the field exists (ie, implementations can assume the field does exist). this method should not return null (should instead return EMPTY if no terms match). The TermsEnum must already be positioned to the first matching term. The given AttributeSource is passed by the MultiTermQuery.RewriteMethod to provide attributes, the rewrite method uses to inform about e.g. maximum competitive boosts. this is currently only used by TopTermsRewrite<Q>.
Declaration
protected override TermsEnum GetTermsEnum(Terms terms, AttributeSource atts)
Parameters
| Type | Name | Description |
|---|---|---|
| Terms | terms | |
| AttributeSource | atts |
Returns
| Type | Description |
|---|---|
| TermsEnum |
Overrides
ToString(string)
Prints a user-readable version of this query.
Declaration
public override string ToString(string field)
Parameters
| Type | Name | Description |
|---|---|---|
| string | field |
Returns
| Type | Description |
|---|---|
| string |