Exemple #1
0
            public override bool Equals(System.Object obj)
            {
                if (this == obj)
                {
                    return(true);
                }
                if (obj == null)
                {
                    return(false);
                }
                if (GetType() != obj.GetType())
                {
                    return(false);
                }

                ConstantScoreAutoRewrite other = (ConstantScoreAutoRewrite)obj;

                if (other.termCountCutoff != termCountCutoff)
                {
                    return(false);
                }

                if (BitConverter.DoubleToInt64Bits(other.docCountPercent) != BitConverter.DoubleToInt64Bits(docCountPercent))
                {
                    return(false);
                }

                return(true);
            }
Exemple #2
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }

            ConstantScoreAutoRewrite other = (ConstantScoreAutoRewrite)obj;

            if (other.TermCountCutoff_Renamed != TermCountCutoff_Renamed)
            {
                return(false);
            }

            if (BitConverter.DoubleToInt64Bits(other.DocCountPercent_Renamed) != BitConverter.DoubleToInt64Bits(DocCountPercent_Renamed))
            {
                return(false);
            }

            return(true);
        }
        public virtual void TestRewritesWithDuplicateTerms()
        {
            CheckDuplicateTerms(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);

            CheckDuplicateTerms(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE);

            // use a large PQ here to only test duplicate terms and dont mix up when all scores are equal
            CheckDuplicateTerms(new MultiTermQuery.TopTermsScoringBooleanQueryRewrite(1024));
            CheckDuplicateTerms(new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite(1024));

            // Test auto rewrite (but only boolean mode), so we set the limits to large values to always get a BQ
            ConstantScoreAutoRewrite rewrite = new ConstantScoreAutoRewrite();

            rewrite.TermCountCutoff = int.MaxValue;
            rewrite.DocCountPercent = 100.0;
            CheckDuplicateTerms(rewrite);
        }