コード例 #1
0
ファイル: SpanScorer.cs プロジェクト: ArsenShnurkov/beagle-1
		internal SpanScorer(Spans spans, Weight weight, Similarity similarity, byte[] norms) : base(similarity)
		{
			this.spans = spans;
			this.norms = norms;
			this.weight = weight;
			this.value_Renamed = weight.GetValue();
		}
コード例 #2
0
 public override bool Next()
 {
     if (LeafOrd >= NumLeaves)
     {
         return false;
     }
     if (Current == null)
     {
         AtomicReaderContext ctx = Leaves[LeafOrd];
         Current = Query.GetSpans(ctx, ((AtomicReader)ctx.Reader()).LiveDocs, TermContexts);
     }
     while (true)
     {
         if (Current.Next())
         {
             return true;
         }
         if (++LeafOrd < NumLeaves)
         {
             AtomicReaderContext ctx = Leaves[LeafOrd];
             Current = Query.GetSpans(ctx, ((AtomicReader)ctx.Reader()).LiveDocs, TermContexts);
         }
         else
         {
             Current = null;
             break;
         }
     }
     return false;
 }
コード例 #3
0
ファイル: SpanScorer.cs プロジェクト: Cefa68000/lucenenet
        protected internal SpanScorer(Spans spans, Weight weight, Similarity.SimScorer docScorer)
            : base(weight)
        {
            this.DocScorer = docScorer;
            this.Spans = spans;

            Doc = -1;
            More = spans.Next();
        }
コード例 #4
0
ファイル: SpanFirstQuery.cs プロジェクト: Cefa68000/lucenenet
 protected internal override AcceptStatus AcceptPosition(Spans spans)
 {
     Debug.Assert(spans.Start() != spans.End(), "start equals end: " + spans.Start());
     if (spans.Start() >= end)
     {
         return AcceptStatus.NO_AND_ADVANCE;
     }
     else if (spans.End() <= end)
     {
         return AcceptStatus.YES;
     }
     else
     {
         return AcceptStatus.NO;
     }
 }
コード例 #5
0
ファイル: SpanScorer.cs プロジェクト: VirtueMe/ravendb
		protected internal SpanScorer(Spans spans, Weight weight, Similarity similarity, byte[] norms):base(similarity)
		{
			this.spans = spans;
			this.norms = norms;
			this.weight = weight;
			this.value_Renamed = weight.GetValue();
			if (this.spans.Next())
			{
				doc = - 1;
			}
			else
			{
				doc = NO_MORE_DOCS;
				more = false;
			}
		}
コード例 #6
0
 protected internal override AcceptStatus AcceptPosition(Spans spans)
 {
     bool result = spans.PayloadAvailable;
     if (result == true)
     {
         ICollection<sbyte[]> candidate = spans.Payload;
         if (candidate.Count == PayloadToMatch.Count)
         {
             //TODO: check the byte arrays are the same
             //hmm, can't rely on order here
             int matches = 0;
             foreach (sbyte[] candBytes in candidate)
             {
                 //Unfortunately, we can't rely on order, so we need to compare all
                 foreach (sbyte[] payBytes in PayloadToMatch)
                 {
                     if (Arrays.Equals(candBytes, payBytes) == true)
                     {
                         matches++;
                         break;
                     }
                 }
             }
             if (matches == PayloadToMatch.Count)
             {
                 //we've verified all the bytes
                 return AcceptStatus.YES;
             }
             else
             {
                 return AcceptStatus.NO;
             }
         }
         else
         {
             return AcceptStatus.NO;
         }
     }
     return AcceptStatus.NO;
 }
コード例 #7
0
 public PositionCheckSpan(SpanPositionCheckQuery outerInstance, AtomicReaderContext context, Bits acceptDocs, IDictionary<Term, TermContext> termContexts)
 {
     this.OuterInstance = outerInstance;
     Spans = outerInstance.match.GetSpans(context, acceptDocs, termContexts);
 }
コード例 #8
0
 private void InitBlock(Lucene.Net.Index.IndexReader reader, SpanFirstQuery enclosingInstance)
 {
     this.reader = reader;
     this.enclosingInstance = enclosingInstance;
     spans = Enclosing_Instance.match.GetSpans(reader);
 }
コード例 #9
0
 public SpansCell(NearSpansUnordered enclosingInstance, Spans spans, int index)
 {
     InitBlock(enclosingInstance);
     this.spans = spans;
     this.index = index;
 }
コード例 #10
0
 protected internal override AcceptStatus AcceptPosition(Spans spans)
 {
     bool result = spans.PayloadAvailable;
     if (result == true)
     {
         var candidate = spans.Payload;
         if (candidate.Count == PayloadToMatch.Count)
         {
             //TODO: check the byte arrays are the same
             var toMatchIter = PayloadToMatch.GetEnumerator();
             //check each of the byte arrays, in order
             //hmm, can't rely on order here
             foreach (var candBytes in candidate)
             {
                 toMatchIter.MoveNext();
                 //if one is a mismatch, then return false
                 if (Arrays.Equals(candBytes, toMatchIter.Current) == false)
                 {
                     return AcceptStatus.NO;
                 }
             }
             //we've verified all the bytes
             return AcceptStatus.YES;
         }
         else
         {
             return AcceptStatus.NO;
         }
     }
     return AcceptStatus.YES;
 }
コード例 #11
0
 /// <summary>
 /// Check whether two Spans in the same document are ordered. </summary>
 /// <returns> true iff spans1 starts before spans2
 ///              or the spans start at the same position,
 ///              and spans1 ends before spans2. </returns>
 internal static bool DocSpansOrdered(Spans spans1, Spans spans2)
 {
     Debug.Assert(spans1.Doc() == spans2.Doc(), "doc1 " + spans1.Doc() + " != doc2 " + spans2.Doc());
     int start1 = spans1.Start();
     int start2 = spans2.Start();
     /* Do not call docSpansOrdered(int,int,int,int) to avoid invoking .end() : */
     return (start1 == start2) ? (spans1.End() < spans2.End()) : (start1 < start2);
 }
コード例 #12
0
        public override bool SkipTo(int target)
        {
            if (LeafOrd >= NumLeaves)
            {
                return false;
            }

            int subIndex = ReaderUtil.SubIndex(target, Leaves);
            Debug.Assert(subIndex >= LeafOrd);
            if (subIndex != LeafOrd)
            {
                AtomicReaderContext ctx = Leaves[subIndex];
                Current = Query.GetSpans(ctx, ((AtomicReader)ctx.Reader).LiveDocs, TermContexts);
                LeafOrd = subIndex;
            }
            else if (Current == null)
            {
                AtomicReaderContext ctx = Leaves[LeafOrd];
                Current = Query.GetSpans(ctx, ((AtomicReader)ctx.Reader).LiveDocs, TermContexts);
            }
            while (true)
            {
                if (target < Leaves[LeafOrd].DocBase)
                {
                    // target was in the previous slice
                    if (Current.Next())
                    {
                        return true;
                    }
                }
                else if (Current.SkipTo(target - Leaves[LeafOrd].DocBase))
                {
                    return true;
                }
                if (++LeafOrd < NumLeaves)
                {
                    AtomicReaderContext ctx = Leaves[LeafOrd];
                    Current = Query.GetSpans(ctx, ((AtomicReader)ctx.Reader).LiveDocs, TermContexts);
                }
                else
                {
                    Current = null;
                    break;
                }
            }

            return false;
        }
コード例 #13
0
		private void  CheckSpans(Spans spans, int expectedNumSpans, int expectedNumPayloads, int expectedPayloadLength, int expectedFirstByte)
		{
			Assert.IsTrue(spans != null, "spans is null and it shouldn't be");
			//each position match should have a span associated with it, since there is just one underlying term query, there should
			//only be one entry in the span
			int seen = 0;
			while (spans.Next() == true)
			{
				//if we expect payloads, then isPayloadAvailable should be true
				if (expectedNumPayloads > 0)
				{
					Assert.IsTrue(spans.IsPayloadAvailable() == true, "isPayloadAvailable is not returning the correct value: " + spans.IsPayloadAvailable() + " and it should be: " + (expectedNumPayloads > 0));
				}
				else
				{
					Assert.IsTrue(spans.IsPayloadAvailable() == false, "isPayloadAvailable should be false");
				}
				//See payload helper, for the PayloadHelper.FIELD field, there is a single byte payload at every token
				if (spans.IsPayloadAvailable())
				{
					System.Collections.Generic.ICollection<byte[]> payload = spans.GetPayload();
					Assert.IsTrue(payload.Count == expectedNumPayloads, "payload Size: " + payload.Count + " is not: " + expectedNumPayloads);
					for (System.Collections.IEnumerator iterator = payload.GetEnumerator(); iterator.MoveNext(); )
					{
						byte[] thePayload = (byte[]) iterator.Current;
						Assert.IsTrue(thePayload.Length == expectedPayloadLength, "payload[0] Size: " + thePayload.Length + " is not: " + expectedPayloadLength);
						Assert.IsTrue(thePayload[0] == expectedFirstByte, thePayload[0] + " does not equal: " + expectedFirstByte);
					}
				}
				seen++;
			}
			Assert.IsTrue(seen == expectedNumSpans, seen + " does not equal: " + expectedNumSpans);
		}
コード例 #14
0
 /// <summary>
 /// Implementing classes are required to return whether the current position is a match for the passed in
 /// "match" <see cref="Lucene.Net.Search.Spans.SpanQuery"/>.
 /// <para/>
 /// This is only called if the underlying <see cref="Lucene.Net.Search.Spans.Spans.MoveNext()"/> for the
 /// match is successful
 /// </summary>
 /// <param name="spans"> The <see cref="Lucene.Net.Search.Spans.Spans"/> instance, positioned at the spot to check </param>
 /// <returns> Whether the match is accepted, rejected, or rejected and should move to the next doc.
 /// </returns>
 /// <seealso cref="Lucene.Net.Search.Spans.Spans.MoveNext()"/>
 protected abstract AcceptStatus AcceptPosition(Spans spans);
コード例 #15
0
 /// <summary>
 /// Implementing classes are required to return whether the current position is a match for the passed in
 /// "match" <seealso cref="Lucene.Net.Search.Spans.SpanQuery"/>.
 ///
 /// this is only called if the underlying <seealso cref="Lucene.Net.Search.Spans.Spans#next()"/> for the
 /// match is successful
 ///
 /// </summary>
 /// <param name="spans"> The <seealso cref="Lucene.Net.Search.Spans.Spans"/> instance, positioned at the spot to check </param>
 /// <returns> whether the match is accepted, rejected, or rejected and should move to the next doc.
 /// </returns>
 /// <seealso cref= Lucene.Net.Search.Spans.Spans#next()
 ///  </seealso>
 protected internal abstract AcceptStatus AcceptPosition(Spans spans);
コード例 #16
0
        /// <summary>
        /// The <see cref="SubSpans"/> are ordered in the same doc, so there is a possible match.
        /// Compute the slop while making the match as short as possible by advancing
        /// all <see cref="SubSpans"/> except the last one in reverse order.
        /// </summary>
        private bool ShrinkToAfterShortestMatch()
        {
            matchStart = subSpans[subSpans.Length - 1].Start;
            matchEnd   = subSpans[subSpans.Length - 1].End;
            var possibleMatchPayloads = new HashSet <byte[]>();

            if (subSpans[subSpans.Length - 1].IsPayloadAvailable)
            {
                possibleMatchPayloads.UnionWith(subSpans[subSpans.Length - 1].GetPayload());
            }

            IList <byte[]> possiblePayload = null;

            int matchSlop = 0;
            int lastStart = matchStart;
            int lastEnd   = matchEnd;

            for (int i = subSpans.Length - 2; i >= 0; i--)
            {
                Spans prevSpans = subSpans[i];
                if (collectPayloads && prevSpans.IsPayloadAvailable)
                {
                    var payload = prevSpans.GetPayload();
                    possiblePayload = new List <byte[]>(payload.Count);
                    possiblePayload.AddRange(payload);
                }

                int prevStart = prevSpans.Start;
                int prevEnd   = prevSpans.End;
                while (true) // Advance prevSpans until after (lastStart, lastEnd)
                {
                    if (!prevSpans.Next())
                    {
                        inSameDoc = false;
                        more      = false;
                        break; // Check remaining subSpans for final match.
                    }
                    else if (matchDoc != prevSpans.Doc)
                    {
                        inSameDoc = false; // The last subSpans is not advanced here.
                        break;             // Check remaining subSpans for last match in this document.
                    }
                    else
                    {
                        int ppStart = prevSpans.Start;
                        int ppEnd   = prevSpans.End; // Cannot avoid invoking .end()
                        if (!DocSpansOrdered(ppStart, ppEnd, lastStart, lastEnd))
                        {
                            break; // Check remaining subSpans.
                        } // prevSpans still before (lastStart, lastEnd)
                        else
                        {
                            prevStart = ppStart;
                            prevEnd   = ppEnd;
                            if (collectPayloads && prevSpans.IsPayloadAvailable)
                            {
                                var payload = prevSpans.GetPayload();
                                possiblePayload = new List <byte[]>(payload.Count);
                                possiblePayload.AddRange(payload);
                            }
                        }
                    }
                }

                if (collectPayloads && possiblePayload != null)
                {
                    possibleMatchPayloads.UnionWith(possiblePayload);
                }

                Debug.Assert(prevStart <= matchStart);
                if (matchStart > prevEnd) // Only non overlapping spans add to slop.
                {
                    matchSlop += (matchStart - prevEnd);
                }

                /* Do not break on (matchSlop > allowedSlop) here to make sure
                 * that subSpans[0] is advanced after the match, if any.
                 */
                matchStart = prevStart;
                lastStart  = prevStart;
                lastEnd    = prevEnd;
            }

            bool match = matchSlop <= allowedSlop;

            if (collectPayloads && match && possibleMatchPayloads.Count > 0)
            {
                matchPayload.AddRange(possibleMatchPayloads);
            }

            return(match); // ordered and allowed slop
        }
コード例 #17
0
 public PositionCheckSpan(SpanPositionCheckQuery outerInstance, AtomicReaderContext context, Bits acceptDocs, IDictionary <Term, TermContext> termContexts)
 {
     this.OuterInstance = outerInstance;
     Spans = outerInstance.match.GetSpans(context, acceptDocs, termContexts);
 }
コード例 #18
0
 public virtual System.String S(Spans span)
 {
     return(S(span.Doc(), span.Start(), span.End()));
 }
コード例 #19
0
ファイル: SpanOrQuery.cs プロジェクト: pchaozhong/FlexNet
            // TODO: Remove warning after API has been finalized
            public override bool IsPayloadAvailable()
            {
                Spans top = Top();

                return(top != null && top.IsPayloadAvailable());
            }
コード例 #20
0
 public virtual string s(Spans span)
 {
     return(s(span.Doc, span.Start, span.End));
 }
コード例 #21
0
 private void CheckSpans(Spans spans, int expectedNumSpans, int expectedNumPayloads, int expectedPayloadLength, int expectedFirstByte)
 {
     Assert.IsTrue(spans != null, "spans is null and it shouldn't be");
     //each position match should have a span associated with it, since there is just one underlying term query, there should
     //only be one entry in the span
     int seen = 0;
     while (spans.Next() == true)
     {
         //if we expect payloads, then isPayloadAvailable should be true
         if (expectedNumPayloads > 0)
         {
             Assert.IsTrue(spans.PayloadAvailable == true, "isPayloadAvailable is not returning the correct value: " + spans.PayloadAvailable + " and it should be: " + (expectedNumPayloads > 0));
         }
         else
         {
             Assert.IsTrue(spans.PayloadAvailable == false, "isPayloadAvailable should be false");
         }
         //See payload helper, for the PayloadHelper.FIELD field, there is a single byte payload at every token
         if (spans.PayloadAvailable)
         {
             var payload = spans.Payload;
             Assert.IsTrue(payload.Count == expectedNumPayloads, "payload Size: " + payload.Count + " is not: " + expectedNumPayloads);
             foreach (var thePayload in payload)
             {
                 Assert.IsTrue(thePayload.Length == expectedPayloadLength, "payload[0] Size: " + thePayload.Length + " is not: " + expectedPayloadLength);
                 Assert.IsTrue(thePayload[0] == expectedFirstByte, thePayload[0] + " does not equal: " + expectedFirstByte);
             }
         }
         seen++;
     }
     Assert.IsTrue(seen == expectedNumSpans, seen + " does not equal: " + expectedNumSpans);
 }
コード例 #22
0
ファイル: TestSpans.cs プロジェクト: zfxsss/lucenenet
        public virtual void TestSpanNearUnOrdered()
        {
            //See http://www.gossamer-threads.com/lists/lucene/java-dev/52270 for discussion about this test
            SpanNearQuery snq;

            snq = new SpanNearQuery(new SpanQuery[] { MakeSpanTermQuery("u1"), MakeSpanTermQuery("u2") }, 0, false);
            Spans spans = MultiSpansWrapper.Wrap(Searcher.TopReaderContext, snq);

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(4, spans.Doc(), "doc");
            Assert.AreEqual(1, spans.Start(), "start");
            Assert.AreEqual(3, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(5, spans.Doc(), "doc");
            Assert.AreEqual(2, spans.Start(), "start");
            Assert.AreEqual(4, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(8, spans.Doc(), "doc");
            Assert.AreEqual(2, spans.Start(), "start");
            Assert.AreEqual(4, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(9, spans.Doc(), "doc");
            Assert.AreEqual(0, spans.Start(), "start");
            Assert.AreEqual(2, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(10, spans.Doc(), "doc");
            Assert.AreEqual(0, spans.Start(), "start");
            Assert.AreEqual(2, spans.End(), "end");
            Assert.IsTrue(spans.Next() == false, "Has next and it shouldn't: " + spans.Doc());

            SpanNearQuery u1u2 = new SpanNearQuery(new SpanQuery[] { MakeSpanTermQuery("u1"), MakeSpanTermQuery("u2") }, 0, false);

            snq   = new SpanNearQuery(new SpanQuery[] { u1u2, MakeSpanTermQuery("u2") }, 1, false);
            spans = MultiSpansWrapper.Wrap(Searcher.TopReaderContext, snq);
            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(4, spans.Doc(), "doc");
            Assert.AreEqual(0, spans.Start(), "start");
            Assert.AreEqual(3, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            //unordered spans can be subsets
            Assert.AreEqual(4, spans.Doc(), "doc");
            Assert.AreEqual(1, spans.Start(), "start");
            Assert.AreEqual(3, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(5, spans.Doc(), "doc");
            Assert.AreEqual(0, spans.Start(), "start");
            Assert.AreEqual(4, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(5, spans.Doc(), "doc");
            Assert.AreEqual(2, spans.Start(), "start");
            Assert.AreEqual(4, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(8, spans.Doc(), "doc");
            Assert.AreEqual(0, spans.Start(), "start");
            Assert.AreEqual(4, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(8, spans.Doc(), "doc");
            Assert.AreEqual(2, spans.Start(), "start");
            Assert.AreEqual(4, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(9, spans.Doc(), "doc");
            Assert.AreEqual(0, spans.Start(), "start");
            Assert.AreEqual(2, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(9, spans.Doc(), "doc");
            Assert.AreEqual(0, spans.Start(), "start");
            Assert.AreEqual(4, spans.End(), "end");

            Assert.IsTrue(spans.Next(), "Does not have next and it should");
            Assert.AreEqual(10, spans.Doc(), "doc");
            Assert.AreEqual(0, spans.Start(), "start");
            Assert.AreEqual(2, spans.End(), "end");

            Assert.IsTrue(spans.Next() == false, "Has next and it shouldn't");
        }
コード例 #23
0
 internal JustCompileSpanScorer(Spans spans, Weight weight, Similarity similarity, byte[] norms) : base(spans, weight, similarity, norms)
 {
 }
コード例 #24
0
		private void  CheckSpans(Spans spans, int numSpans, int[] numPayloads)
		{
			int cnt = 0;
			
			while (spans.Next() == true)
			{
				if (DEBUG)
					System.Console.Out.WriteLine("\nSpans Dump --");
				if (spans.IsPayloadAvailable())
				{
					System.Collections.Generic.ICollection<byte[]> payload = spans.GetPayload();
					if (DEBUG)
						System.Console.Out.WriteLine("payloads for span:" + payload.Count);
					System.Collections.IEnumerator it = payload.GetEnumerator();
					while (it.MoveNext())
					{
						byte[] bytes = (byte[]) it.Current;
						if (DEBUG)
							System.Console.Out.WriteLine("doc:" + spans.Doc() + " s:" + spans.Start() + " e:" + spans.End() + " " + new System.String(System.Text.UTF8Encoding.UTF8.GetChars(bytes)));
					}
					
					Assert.AreEqual(numPayloads[cnt], payload.Count);
				}
				else
				{
					Assert.IsFalse(numPayloads.Length > 0 && numPayloads[cnt] > 0, "Expected spans:" + numPayloads[cnt] + " found: 0");
				}
				cnt++;
			}
			
			Assert.AreEqual(numSpans, cnt);
		}
コード例 #25
0
ファイル: SpanNotQuery.cs プロジェクト: sinsay/SSE
 private void InitBlock(Lucene.Net.Index.IndexReader reader, SpanNotQuery enclosingInstance)
 {
     this.reader = reader;
     this.enclosingInstance = enclosingInstance;
     includeSpans = Enclosing_Instance.include.GetSpans(reader);
     excludeSpans = Enclosing_Instance.exclude.GetSpans(reader);
     moreExclude = excludeSpans.Next();
 }
コード例 #26
0
        private void CheckSpans(Spans spans, int numSpans, int[] numPayloads)
        {
            int cnt = 0;

            while (spans.Next() == true)
            {
                if (VERBOSE)
                {
                    Console.WriteLine("\nSpans Dump --");
                }
                if (spans.PayloadAvailable)
                {
                    var payload = spans.Payload;
                    if (VERBOSE)
                    {
                        Console.WriteLine("payloads for span:" + payload.Count);
                        foreach (var bytes in payload)
                        {
                            Console.WriteLine("doc:" + spans.Doc() + " s:" + spans.Start() + " e:" + spans.End() + " " + Encoding.UTF8.GetString((byte[])(Array)bytes));
                        }
                    }

                    Assert.AreEqual(numPayloads[cnt], payload.Count);
                }
                else
                {
                    Assert.IsFalse(numPayloads.Length > 0 && numPayloads[cnt] > 0, "Expected spans:" + numPayloads[cnt] + " found: 0");
                }
                cnt++;
            }

            Assert.AreEqual(numSpans, cnt);
        }
コード例 #27
0
		public virtual System.String S(Spans span)
		{
			return S(span.Doc(), span.Start(), span.End());
		}
コード例 #28
0
ファイル: TestBasics.cs プロジェクト: WakeflyCBass/lucenenet
 /// <summary>
 /// Skips to the first match beyond the current, whose document number is
 /// greater than or equal to <i>target</i>. <p>Returns true iff there is such
 /// a match.  <p>Behaves as if written: <pre>
 ///   boolean skipTo(int target) {
 ///     do {
 ///       if (!next())
 ///       return false;
 ///     } while (target > doc());
 ///     return true;
 ///   }
 /// </pre>
 /// </summary>
 private bool SkipToAccoringToJavaDocs(Spans s, int target)
 {
     do
     {
         if (!s.Next())
         {
             return false;
         }
     } while (target > s.Doc());
     return true;
 }
コード例 #29
0
ファイル: TestSpans.cs プロジェクト: Cefa68000/lucenenet
 private void TstNextSpans(Spans spans, int doc, int start, int end)
 {
     Assert.IsTrue(spans.Next(), "next");
     Assert.AreEqual(doc, spans.Doc(), "doc");
     Assert.AreEqual(start, spans.Start(), "start");
     Assert.AreEqual(end, spans.End(), "end");
 }
コード例 #30
0
			internal JustCompileSpanScorer(Spans spans, Weight weight, Similarity similarity, byte[] norms):base(spans, weight, similarity, norms)
			{
			}
コード例 #31
0
 public SpansCell(NearSpansUnordered outerInstance, Spans spans, int index)
 {
     this.outerInstance = outerInstance;
     this.spans         = spans;
     this.index         = index;
 }
コード例 #32
0
			public SpansCell(NearSpansUnordered enclosingInstance, Spans spans, int index)
			{
				InitBlock(enclosingInstance);
				this.spans = spans;
				this.index = index;
			}
コード例 #33
0
 protected internal JustCompileSpanScorer(Spans spans, Weight weight, Similarity.SimScorer docScorer)
     : base(spans, weight, docScorer)
 {
 }
コード例 #34
0
 public virtual string s(Spans span)
 {
     return s(span.Doc(), span.Start(), span.End());
 }
コード例 #35
0
 /// <summary>
 /// Implementing classes are required to return whether the current position is a match for the passed in
 /// "match" <seealso cref="Lucene.Net.Search.Spans.SpanQuery"/>.
 ///
 /// this is only called if the underlying <seealso cref="Lucene.Net.Search.Spans.Spans#next()"/> for the
 /// match is successful
 ///
 /// </summary>
 /// <param name="spans"> The <seealso cref="Lucene.Net.Search.Spans.Spans"/> instance, positioned at the spot to check </param>
 /// <returns> whether the match is accepted, rejected, or rejected and should move to the next doc.
 /// </returns>
 /// <seealso cref= Lucene.Net.Search.Spans.Spans#next()
 ///  </seealso>
 protected internal abstract AcceptStatus AcceptPosition(Spans spans);
コード例 #36
0
 private void InitBlock(IndexReader reader, SpanLastQuery enclosingInstance)
 {
     this.reader = reader;
     this.enclosingInstance = enclosingInstance;
     this.spans = this.Enclosing_Instance.match.GetSpans(reader);
 }
コード例 #37
0
 internal JustCompileSpanScorer(Spans spans, Weight weight, Similarity.SimScorer docScorer)
     : base(spans, weight, docScorer)
 {
 }