Class Hit

  • All Implemented Interfaces:
    Cloneable
    Direct Known Subclasses:
    FS4Hit, VdsHit

    public abstract class Hit
    extends com.yahoo.vespa.objects.Identifiable
    This class represents a generic hit with a rank value. Actual hits are represented using subclasses of this class.
    Author:
    havardpe
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int classId  
    • Constructor Summary

      Constructors 
      Constructor Description
      Hit()
      Constructs an empty result node.
      Hit​(double rank)
      Create a new hit with the given rank
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(Object obj)  
      Object getContext()
      Returns the context object of this hit.
      double getRank()
      Obtain the rank of this hit.
      int hashCode()  
      protected void onDeserialize​(com.yahoo.vespa.objects.Deserializer buf)  
      protected void onSerialize​(com.yahoo.vespa.objects.Serializer buf)  
      Hit setContext​(Object context)
      Sets the context object of this hit.
      void visitMembers​(com.yahoo.vespa.objects.ObjectVisitor visitor)  
      • Methods inherited from class com.yahoo.vespa.objects.Identifiable

        clone, create, createFromId, deserialize, deserializeOptional, deserializeWithId, equals, getClassId, getRawUtf8Bytes, getUtf8, onGetClassId, putUtf8, registerClass, serialize, serializeOptional, serializeWithId, toString
      • Methods inherited from class com.yahoo.vespa.objects.Selectable

        select, select, selectMembers
    • Field Detail

      • classId

        public static final int classId
    • Constructor Detail

      • Hit

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

        public Hit​(double rank)
        Create a new hit with the given rank
        Parameters:
        rank - generic rank value
    • Method Detail

      • getRank

        public double getRank()
        Obtain the rank of this hit. This is a comparable rank to allow multilevel sorting on arbitrary rank type.
        Returns:
        generic rank value
      • getContext

        public Object getContext()
        Returns the context object of this hit.
        Returns:
        The context object.
      • setContext

        public Hit setContext​(Object context)
        Sets the context object of this hit. This is not serialized, and is merely a tag used by the QRS.
        Parameters:
        context - The context to set.
        Returns:
        This, to allow chaining.
      • onSerialize

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

        protected void onDeserialize​(com.yahoo.vespa.objects.Deserializer buf)
        Overrides:
        onDeserialize in class com.yahoo.vespa.objects.Identifiable
      • hashCode

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

        public boolean equals​(Object obj)
        Overrides:
        equals in class com.yahoo.vespa.objects.Identifiable
      • visitMembers

        public void visitMembers​(com.yahoo.vespa.objects.ObjectVisitor visitor)
        Overrides:
        visitMembers in class com.yahoo.vespa.objects.Identifiable