org.apache.lucene.queries.function

## Class FunctionQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.queries.function.FunctionQuery

All Implemented Interfaces:
  Cloneable

    public class FunctionQuery
    extends Query

Returns a score for each document based on a ValueSource, often some function of the value of a field. Note: This API is experimental and may change in non backward-compatible ways in the future

### Nested Class Summary

Nested Classes
`protected class` `FunctionQuery.AllScorer`
`protected class` `FunctionQuery.FunctionWeight`

### Constructor Summary

Constructors
Constructor and Description
`FunctionQuery(ValueSource func)`

### Method Summary

Methods
`Weight` `createWeight(IndexSearcher searcher)`
`boolean` `equals(Object o)` Returns true if `o` is equal to this.
`void` `extractTerms(Set<Term> terms)`
`ValueSource` `getValueSource()`
`int` `hashCode()` Returns a hash code value for this object.
`Query` `rewrite(IndexReader reader)`
`String` `toString(String field)` Prints a user-readable version of this query.

### Methods inherited from class org.apache.lucene.search.Query

`clone, getBoost, setBoost, toString`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### FunctionQuery

    public FunctionQuery(ValueSource func)

Parameters:
  `func` - defines the function to be used for scoring

### Method Detail

#### getValueSource

    public ValueSource getValueSource()

Returns:
  The associated ValueSource

#### rewrite

    public Query rewrite(IndexReader reader)
                  throws IOException

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

#### extractTerms

    public void extractTerms(Set<Term> terms)

Overrides:
  `extractTerms` in class `Query`

#### createWeight

    public Weight createWeight(IndexSearcher searcher)
                        throws IOException

Overrides:
  `createWeight` 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 if `o` is equal to this.

Overrides:
  `equals` in class `Query`

#### hashCode

    public int hashCode()

Returns a hash code value for this object.

Overrides:
  `hashCode` in class `Query`