Class Diversity

  • All Implemented Interfaces:
    Cloneable

    public class Diversity
    extends Object
    implements 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​(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 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 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 Double getCutoffFactor()
      • setCutoffStrategy

        public void setCutoffStrategy​(String cutoffStrategy)
      • prepare

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

        public int hashCode()
        Overrides:
        hashCode in class Object