PrefixQuery (Lucene 2.4.1 API)
Keywords: org.apache.lucene.search.PrefixQuery class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.search
Class PrefixQuery

    java.lang.Object
      org.apache.lucene.search.Query
          org.apache.lucene.search.PrefixQuery

All Implemented Interfaces:
  Serializable, Cloneable

    public class PrefixQuery

extends Query

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

See Also:
  Serialized Form

Constructor Summary
`PrefixQuery(Term prefix)` Constructs a query for terms starting with `prefix`.

Method Summary
`boolean` | `equals(Object o)` Returns true iff `o` is equal to this.
`Term` | `getPrefix()` Returns the prefix of this query.
`int` | `hashCode()` Returns a hash code value for this object.
`Query` | `rewrite(IndexReader reader)` Expert: called to re-write queries into primitive queries.
`String` | `toString(String field)` Prints a user-readable version of this query.

Methods inherited from class org.apache.lucene.search.Query
`clone, combine, createWeight, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PrefixQuery

    public PrefixQuery(Term prefix)

  Constructs a query for terms starting with `prefix`.

Method Detail

### getPrefix

    public Term getPrefix()

  Returns the prefix of this query.

### rewrite

    public Query rewrite(IndexReader reader)
                  throws IOException

  Description copied from class: `Query`
  Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.

  Overrides:
    `rewrite` in class `Query`
  Throws:
    `IOException`

### toString

    public String toString(String field)

  Prints a user-readable version of this query.

  Specified by:
    `toString` in class `Query`

### equals

    public boolean equals(Object o)

  Returns true iff `o` is equal to this.

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Returns a hash code value for this object.

  Overrides:
    `hashCode` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.