public class

PrefixQuery

extends MultiTermQuery
java.lang.Object
   ↳ org.apache.lucene.search.Query
     ↳ org.apache.lucene.search.MultiTermQuery
       ↳ org.apache.lucene.search.PrefixQuery

Class Overview

A Query that matches documents containing terms with a specified prefix. A PrefixQuery is built by QueryParser for input like app*.

This query uses the CONSTANT_SCORE_AUTO_REWRITE_DEFAULT rewrite method.

Summary

[Expand]
Inherited Fields
From class org.apache.lucene.search.MultiTermQuery
Public Constructors
PrefixQuery(Term prefix)
Constructs a query for terms starting with prefix.
Public Methods
boolean equals(Object obj)
Term getPrefix()
Returns the prefix of this query.
int hashCode()
String toString(String field)
Prints a user-readable version of this query.
Protected Methods
FilteredTermEnum getEnum(IndexReader reader)
Construct the enumeration to be used, expanding the pattern term.
[Expand]
Inherited Methods
From class org.apache.lucene.search.MultiTermQuery
From class org.apache.lucene.search.Query
From class java.lang.Object

Public Constructors

public PrefixQuery (Term prefix)

Constructs a query for terms starting with prefix.

Public Methods

public boolean equals (Object obj)

public Term getPrefix ()

Returns the prefix of this query.

public int hashCode ()

public String toString (String field)

Prints a user-readable version of this query.

Protected Methods

protected FilteredTermEnum getEnum (IndexReader reader)

Construct the enumeration to be used, expanding the pattern term.

Throws
IOException