org.apache.lucene.queries.function

## Class FunctionQuery

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

-     public class FunctionQuery
      extends Query

  Returns a score for each document based on a ValueSource, often some function of the value of a field.
  See Also:
    `ValueSourceScorer`
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `FunctionQuery.AllScorer`
    `protected class` | `FunctionQuery.FunctionWeight`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FunctionQuery(ValueSource func)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Weight` | `createWeight(IndexSearcher searcher, boolean needsScores)`
    `boolean` | `equals(Object other)` Returns true if `o` is equal to this.
    `ValueSource` | `getValueSource()`
    `int` | `hashCode()`
    `String` | `toString(String field)` Prints a user-readable version of this query.

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

      `classHash, rewrite, sameClassAs, toString`

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

      `clone, 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

    - #### createWeight

          public Weight createWeight(IndexSearcher searcher,
                                     boolean needsScores)
                              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 other)

      Returns true if `o` is equal to this.
      Specified by:
        `equals` in class `Query`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in class `Query`

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