Example #1
0
        private Scorer DualConjunctionSumScorer(Scorer req1, Scorer req2)
        {
            // non counting.
            int requiredNrMatchers = requiredScorers.Count;
            ConjunctionScorer cs   = new ConjunctionScorer(defaultSimilarity);

            // All scorers match, so defaultSimilarity super.score() always has 1 as
            // the coordination factor.
            // Therefore the sum of the scores of two scorers
            // is used as score.
            cs.Add(req1);
            cs.Add(req2);
            return(cs);
        }
Example #2
0
        private Scorer DualConjunctionSumScorer(Scorer req1, Scorer req2)
        {
            // non counting.
            //UPGRADE_NOTE: Final was removed from the declaration of 'requiredNrMatchers '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
            int requiredNrMatchers = requiredScorers.Count;
            ConjunctionScorer cs   = new ConjunctionScorer(defaultSimilarity);

            // All scorers match, so defaultSimilarity super.score() always has 1 as
            // the coordination factor.
            // Therefore the sum of the scores of two scorers
            // is used as score.
            cs.Add(req1);
            cs.Add(req2);
            return(cs);
        }
Example #3
0
 public ComparatorAnonymousInnerClassHelper(ConjunctionScorer outerInstance)
 {
     this.OuterInstance = outerInstance;
 }
 private Scorer DualConjunctionSumScorer(Scorer req1, Scorer req2)
 {
     // non counting.
     //UPGRADE_NOTE: Final was removed from the declaration of 'requiredNrMatchers '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
     int requiredNrMatchers = requiredScorers.Count;
     ConjunctionScorer cs = new ConjunctionScorer(defaultSimilarity);
     // All scorers match, so defaultSimilarity super.score() always has 1 as
     // the coordination factor.
     // Therefore the sum of the scores of two scorers
     // is used as score.
     cs.Add(req1);
     cs.Add(req2);
     return cs;
 }
Example #5
0
			private void  InitBlock(ConjunctionScorer enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
Example #6
0
			public AnonymousClassComparator(ConjunctionScorer enclosingInstance)
			{
				InitBlock(enclosingInstance);
			}
Example #7
0
            /// <returns> A good old 1.4 Scorer
            /// </returns>
            public virtual Scorer Scorer(IndexReader reader)
            {
                // First see if the (faster) ConjunctionScorer will work.  This can be
                // used when all clauses are required.  Also, at this point a
                // BooleanScorer cannot be embedded in a ConjunctionScorer, as the hits
                // from a BooleanScorer are not always sorted by document number (sigh)
                // and hence BooleanScorer cannot implement skipTo() correctly, which is
                // required by ConjunctionScorer.
                bool allRequired = true;
                bool noneBoolean = true;

                for (int i = 0; i < weights.Count; i++)
                {
                    BooleanClause c = (BooleanClause)Enclosing_Instance.clauses[i];
                    if (!c.IsRequired())
                    {
                        allRequired = false;
                    }
                    if (c.GetQuery() is BooleanQuery)
                    {
                        noneBoolean = false;
                    }
                }

                if (allRequired && noneBoolean)
                {
                    // ConjunctionScorer is okay
                    ConjunctionScorer result = new ConjunctionScorer(similarity);
                    for (int i = 0; i < weights.Count; i++)
                    {
                        Weight w         = (Weight)weights[i];
                        Scorer subScorer = w.Scorer(reader);
                        if (subScorer == null)
                        {
                            return(null);
                        }
                        result.Add(subScorer);
                    }
                    return(result);
                }

                // Use good-old BooleanScorer instead.
                BooleanScorer result2 = new BooleanScorer(similarity);

                for (int i = 0; i < weights.Count; i++)
                {
                    BooleanClause c         = (BooleanClause)Enclosing_Instance.clauses[i];
                    Weight        w         = (Weight)weights[i];
                    Scorer        subScorer = w.Scorer(reader);
                    if (subScorer != null)
                    {
                        result2.Add(subScorer, c.IsRequired(), c.IsProhibited());
                    }
                    else if (c.IsRequired())
                    {
                        return(null);
                    }
                }

                return(result2);
            }
Example #8
0
 private void  InitBlock(ConjunctionScorer enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
Example #9
0
 public AnonymousClassComparator(ConjunctionScorer enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Example #10
0
			/// <returns> A good old 1.4 Scorer 
			/// </returns>
			public virtual Scorer Scorer(IndexReader reader)
			{
				// First see if the (faster) ConjunctionScorer will work.  This can be
				// used when all clauses are required.  Also, at this point a
				// BooleanScorer cannot be embedded in a ConjunctionScorer, as the hits
				// from a BooleanScorer are not always sorted by document number (sigh)
				// and hence BooleanScorer cannot implement skipTo() correctly, which is
				// required by ConjunctionScorer.
				bool allRequired = true;
				bool noneBoolean = true;
				for (int i = 0; i < weights.Count; i++)
				{
					BooleanClause c = (BooleanClause) Enclosing_Instance.clauses[i];
					if (!c.IsRequired())
						allRequired = false;
					if (c.GetQuery() is BooleanQuery)
						noneBoolean = false;
				}
				
				if (allRequired && noneBoolean)
				{
					// ConjunctionScorer is okay
					ConjunctionScorer result = new ConjunctionScorer(similarity);
					for (int i = 0; i < weights.Count; i++)
					{
						Weight w = (Weight) weights[i];
						Scorer subScorer = w.Scorer(reader);
						if (subScorer == null)
							return null;
						result.Add(subScorer);
					}
					return result;
				}
				
				// Use good-old BooleanScorer instead.
				BooleanScorer result2 = new BooleanScorer(similarity);
				
				for (int i = 0; i < weights.Count; i++)
				{
					BooleanClause c = (BooleanClause) Enclosing_Instance.clauses[i];
					Weight w = (Weight) weights[i];
					Scorer subScorer = w.Scorer(reader);
					if (subScorer != null)
						result2.Add(subScorer, c.IsRequired(), c.IsProhibited());
					else if (c.IsRequired())
						return null;
				}
				
				return result2;
			}
Example #11
0
		private Scorer DualConjunctionSumScorer(Scorer req1, Scorer req2)
		{
			// non counting. 
			int requiredNrMatchers = requiredScorers.Count;
			ConjunctionScorer cs = new ConjunctionScorer(defaultSimilarity);
			// All scorers match, so defaultSimilarity super.score() always has 1 as
			// the coordination factor.
			// Therefore the sum of the scores of two scorers
			// is used as score.
			cs.Add(req1);
			cs.Add(req2);
			return cs;
		}