示例#1
0
        public virtual void  TestSpanScorerZeroSloppyFreq()
        {
            bool ordered = true;
            int  slop    = 1;

            Similarity sim = new AnonymousClassDefaultSimilarity(this);

            SpanNearQuery snq = new AnonymousClassSpanNearQuery(sim, this, new SpanQuery[] { MakeSpanTermQuery("t1"), MakeSpanTermQuery("t2") }, slop, ordered);

            Scorer spanScorer = snq.Weight(searcher).Scorer(searcher.GetIndexReader(), true, false);

            Assert.IsTrue(spanScorer.NextDoc() != DocIdSetIterator.NO_MORE_DOCS, "first doc");
            Assert.AreEqual(spanScorer.DocID(), 11, "first doc number");
            float score = spanScorer.Score();

            Assert.IsTrue(score == 0.0f, "first doc score should be zero, " + score);
            Assert.IsTrue(spanScorer.NextDoc() == DocIdSetIterator.NO_MORE_DOCS, "no second doc");
        }
示例#2
0
		public virtual void  TestSpanScorerZeroSloppyFreq()
		{
			bool ordered = true;
			int slop = 1;
			
			Similarity sim = new AnonymousClassDefaultSimilarity(this);
			
			SpanNearQuery snq = new AnonymousClassSpanNearQuery(sim, this, new SpanQuery[]{MakeSpanTermQuery("t1"), MakeSpanTermQuery("t2")}, slop, ordered);
			
			Scorer spanScorer = snq.Weight(searcher).Scorer(searcher.GetIndexReader(), true, false);
			
			Assert.IsTrue(spanScorer.NextDoc() != DocIdSetIterator.NO_MORE_DOCS, "first doc");
			Assert.AreEqual(spanScorer.DocID(), 11, "first doc number");
			float score = spanScorer.Score();
			Assert.IsTrue(score == 0.0f, "first doc score should be zero, " + score);
			Assert.IsTrue(spanScorer.NextDoc() == DocIdSetIterator.NO_MORE_DOCS, "no second doc");
		}