Class HitsAggregationResult

java.lang.Object
com.yahoo.vespa.objects.Selectable
com.yahoo.vespa.objects.Identifiable
All Implemented Interfaces:
Serializable, Cloneable

public class HitsAggregationResult extends AggregationResult
This is an aggregated result holding the top n hits for a single group.
Author:
havardpe, baldersheim, Simon Thoresen Hult
See Also:
  • Field Details

    • classId

      public static final int classId
  • Constructor Details

    • HitsAggregationResult

      public HitsAggregationResult()
      Constructs an empty result node.
    • HitsAggregationResult

      public HitsAggregationResult(int maxHits)
      Create a hits aggregation result that will collect the given number of hits
      Parameters:
      maxHits - maximum number of hits to collect
    • HitsAggregationResult

      public HitsAggregationResult(int maxHits, String summaryClass)
      Create a hits aggregation result that will collect the given number of hits of the summaryClass asked.
      Parameters:
      maxHits - maximum number of hits to collect
      summaryClass - SummaryClass to use for hits to collect
  • Method Details

    • getSummaryClass

      public String getSummaryClass()
      Obtain the summary class used to collect the hits.
      Returns:
      The summary class id.
    • getMaxHits

      public int getMaxHits()
      Obtain the maximum number of hits to collect.
      Returns:
      Max number of hits to collect.
    • setSummaryClass

      public HitsAggregationResult setSummaryClass(String summaryClass)
      Sets the summary class of hits to collect.
      Parameters:
      summaryClass - the summary class to collect.
      Returns:
      this, to allow chaining.
    • setMaxHits

      public HitsAggregationResult setMaxHits(int maxHits)
      Sets the maximum number of hits to collect.
      Parameters:
      maxHits - the number of hits to collect.
      Returns:
      this, to allow chaining.
    • getHits

      public List<Hit> getHits()
      Obtain the hits collected by this aggregation result
      Returns:
      collected hits
    • addHit

      public HitsAggregationResult addHit(Hit h)
      Adds a hit to this aggregation result
      Parameters:
      h - the hit
      Returns:
      this object
    • getRank

      public ResultNode getRank()
      Description copied from class: AggregationResult
      Returns a value that can be used for ranking.
      Specified by:
      getRank in class AggregationResult
    • onGetClassId

      protected int onGetClassId()
      Overrides:
      onGetClassId in class AggregationResult
    • onSerialize

      protected void onSerialize(com.yahoo.vespa.objects.Serializer buf)
      Overrides:
      onSerialize in class AggregationResult
    • onDeserialize

      protected void onDeserialize(com.yahoo.vespa.objects.Deserializer buf)
      Overrides:
      onDeserialize in class AggregationResult
    • onMerge

      protected void onMerge(AggregationResult result)
      Description copied from class: AggregationResult
      Mmust be implemented by subclasses to support merge. It is called as the AggregationResult.merge(AggregationResult) method is invoked.
      Specified by:
      onMerge in class AggregationResult
      Parameters:
      result - the result to merge with
    • postMerge

      public void postMerge()
      Description copied from class: AggregationResult
      Hook called when all aggregation results have been merged. This method can be overloaded by subclasses that need special behaviour to occur after merge.
      Overrides:
      postMerge in class AggregationResult
    • equalsAggregation

      protected boolean equalsAggregation(AggregationResult obj)
      Specified by:
      equalsAggregation in class AggregationResult
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class com.yahoo.vespa.objects.Identifiable
    • clone

      public HitsAggregationResult clone()
      Overrides:
      clone in class AggregationResult
    • visitMembers

      public void visitMembers(com.yahoo.vespa.objects.ObjectVisitor visitor)
      Overrides:
      visitMembers in class AggregationResult
    • selectMembers

      public void selectMembers(com.yahoo.vespa.objects.ObjectPredicate predicate, com.yahoo.vespa.objects.ObjectOperation operation)
      Overrides:
      selectMembers in class com.yahoo.vespa.objects.Selectable