HighlightsMatch (Lucene 10.5.1 monitor API)
Description: declaration: package: org.apache.lucene.monitor, class: HighlightsMatch

Package org.apache.lucene.monitor

# Class HighlightsMatch

java.lang.Object
org.apache.lucene.monitor.QueryMatch
org.apache.lucene.monitor.HighlightsMatch

public class HighlightsMatch extends QueryMatch
QueryMatch object that contains the hit positions of a matching Query

If the Query does not support interval iteration (eg, if it gets re-written to a Filter), then no hits will be reported, but an IntervalsQueryMatch will still be returned from an IntervalsMatcher to indicate a match.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final record`
  `HighlightsMatch.Hit`
  Represents an individual hit

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final MatcherFactory<HighlightsMatch>`
  `MATCHER`

  ### Fields inherited from class org.apache.lucene.monitor.QueryMatch

  `SIMPLE_MATCHER`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `Set<String>`
  `getFields()`
  `int`
  `getHitCount()`
  `Map<String,Set<HighlightsMatch.Hit>>`
  `getHits()`
  `Collection<HighlightsMatch.Hit>`
  `getHits(String field)`
  Get the hits for a specific field
  `int`
  `hashCode()`
  `String`
  `toString()`

  ### Methods inherited from class org.apache.lucene.monitor.QueryMatch

  `getQueryId`

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

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

- ## Field Details

  - ### MATCHER

    public static final MatcherFactory<HighlightsMatch> MATCHER

- ## Method Details

  - ### getHits

    public Map<String,Set<HighlightsMatch.Hit>> getHits()
    Returns:
      a map of hits per field

  - ### getFields

    public Set<String> getFields()
    Returns:
      the fields in which matches have been found

  - ### getHits

    public Collection<HighlightsMatch.Hit> getHits(String field)
    Get the hits for a specific field
    Parameters:
      `field` - the field
    Returns:
      the Hits found in this field

  - ### getHitCount

    public int getHitCount()
    Returns:
      the total number of hits for the query

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `QueryMatch`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `QueryMatch`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `QueryMatch`