Package org.apache.lucene.queries.spans

# Class SpanMultiTermQueryWrapper.TopTermsSpanBooleanQueryRewrite

java.lang.Object
org.apache.lucene.search.MultiTermQuery.RewriteMethod
org.apache.lucene.queries.spans.SpanMultiTermQueryWrapper.SpanRewriteMethod
org.apache.lucene.queries.spans.SpanMultiTermQueryWrapper.TopTermsSpanBooleanQueryRewrite

Enclosing class:
  `SpanMultiTermQueryWrapper<Q extends MultiTermQuery>`

public static final class SpanMultiTermQueryWrapper.TopTermsSpanBooleanQueryRewrite extends SpanMultiTermQueryWrapper.SpanRewriteMethod
A rewrite method that first translates each term into a SpanTermQuery in a `BooleanClause.Occur.SHOULD` clause in a BooleanQuery, and keeps the scores as computed by the query.

This rewrite method only uses the top scoring terms so it will not overflow the boolean max clause count.

See Also:
  - `SpanMultiTermQueryWrapper.setRewriteMethod(org.apache.lucene.queries.spans.SpanMultiTermQueryWrapper.SpanRewriteMethod)`

## Constructor Summary

Constructors
Constructor
Description
`TopTermsSpanBooleanQueryRewrite(int size)`
Create a TopTermsSpanBooleanQueryRewrite for at most `size` terms.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object obj)`
`int`
`getSize()`
return the maximum priority queue size
`int`
`hashCode()`
`SpanQuery`
`rewrite(IndexSearcher indexSearcher, MultiTermQuery query)`

### Methods inherited from class org.apache.lucene.search.MultiTermQuery.RewriteMethod

`getTermsEnum`

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

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

## Constructor Details

### TopTermsSpanBooleanQueryRewrite

public TopTermsSpanBooleanQueryRewrite(int size)
Create a TopTermsSpanBooleanQueryRewrite for at most `size` terms.

## Method Details

### getSize

public int getSize()
return the maximum priority queue size

### rewrite

public SpanQuery rewrite(IndexSearcher indexSearcher, MultiTermQuery query) throws IOException

Specified by:
  `rewrite` in class `SpanMultiTermQueryWrapper.SpanRewriteMethod`
Throws:
  `IOException`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`