org.apache.lucene.queries.payloads

## Class PayloadScoreQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.search.spans.SpanQuery
    - - org.apache.lucene.queries.payloads.PayloadScoreQuery

-     public class PayloadScoreQuery
      extends SpanQuery

  A Query class that uses a `PayloadFunction` to modify the score of a wrapped SpanQuery

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PayloadScoreQuery(SpanQuery wrappedQuery, PayloadFunction function, PayloadDecoder decoder)` Creates a new PayloadScoreQuery that includes the underlying span scores
    `PayloadScoreQuery(SpanQuery wrappedQuery, PayloadFunction function, PayloadDecoder decoder, boolean includeSpanScore)` Creates a new PayloadScoreQuery

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SpanWeight` | `createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)`
    `boolean` | `equals(Object other)`
    `String` | `getField()`
    `int` | `hashCode()`
    `Query` | `rewrite(IndexReader reader)`
    `String` | `toString(String field)`
    `void` | `visit(QueryVisitor visitor)`

    - ### Methods inherited from class org.apache.lucene.search.spans.SpanQuery

      `getTermStates, getTermStates`

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

      `classHash, sameClassAs, toString`

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

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

- - ### Constructor Detail

    - #### PayloadScoreQuery

          public PayloadScoreQuery(SpanQuery wrappedQuery,
                                   PayloadFunction function,
                                   PayloadDecoder decoder,
                                   boolean includeSpanScore)

      Creates a new PayloadScoreQuery
      Parameters:
        `wrappedQuery` - the query to wrap
        `function` - a PayloadFunction to use to modify the scores
        `decoder` - a PayloadDecoder to convert payloads into float values
        `includeSpanScore` - include both span score and payload score in the scoring algorithm

    - #### PayloadScoreQuery

          public PayloadScoreQuery(SpanQuery wrappedQuery,
                                   PayloadFunction function,
                                   PayloadDecoder decoder)

      Creates a new PayloadScoreQuery that includes the underlying span scores
      Parameters:
        `wrappedQuery` - the query to wrap
        `function` - a PayloadFunction to use to modify the scores

  - ### Method Detail

    - #### getField

          public String getField()

      Specified by:
        `getField` in class `SpanQuery`

    - #### rewrite

          public Query rewrite(IndexReader reader)
                        throws IOException

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

    - #### visit

          public void visit(QueryVisitor visitor)

      Overrides:
        `visit` in class `Query`

    - #### toString

          public String toString(String field)

      Specified by:
        `toString` in class `Query`

    - #### createWeight

          public SpanWeight createWeight(IndexSearcher searcher,
                                         ScoreMode scoreMode,
                                         float boost)
                                  throws IOException

      Overrides:
        `createWeight` in class `SpanQuery`
      Throws:
        `IOException`

    - #### equals

          public boolean equals(Object other)

      Specified by:
        `equals` in class `Query`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in class `Query`

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