Class Diversity

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class Diversity
    extends java.lang.Object
    implements java.lang.Cloneable

    The diversity settings during match phase of a query. These are the same settings for diversity during match phase that can be set in a rank profile and is used for achieving guaranteed diversity at the cost of slightly higher cost as more hits must be considered compared to plain match-phase.

    You specify an additional attribute to be the diversifier and also min diversity needed.

    Author:
    baldersheim
    • Constructor Detail

      • Diversity

        public Diversity()
    • Method Detail

      • setAttribute

        public void setAttribute​(java.lang.String attribute)
        Sets the attribute field which will be used to guarantee diversity. Set to null (default) to disable diversification.

        If this is set, make sure to also set the maxGroups value.

        This attribute must be singlevalue.

      • getAttribute

        public java.lang.String getAttribute()
        Returns the attribute to use for diversity, or null if none
      • setMinGroups

        public void setMinGroups​(long minGroups)
        Sets the max hits to aim for producing in the match phase. This must be set if an attribute value is set. It should be set to a reasonable fraction of the total documents on each partition.
      • getMinGroups

        public java.lang.Long getMinGroups()
        Returns the max hits to aim for producing in the match phase on each content node, or null if not set
      • setCutoffFactor

        public void setCutoffFactor​(double cutoffFactor)
      • getCutoffFactor

        public java.lang.Double getCutoffFactor()
      • setCutoffStrategy

        public void setCutoffStrategy​(java.lang.String cutoffStrategy)
      • prepare

        public void prepare​(RankProperties rankProperties)
        Internal operation - DO NOT USE
      • clone

        public Diversity clone()
        Overrides:
        clone in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object