public override bool SkipTo(int target) { if (FirstTime) // initialize { InitList(false); for (SpansCell cell = First; More && cell != null; cell = cell.Next_Renamed) { More = cell.SkipTo(target); // skip all } if (More) { ListToQueue(); } FirstTime = false; } // normal case else { while (More && Min().Doc() < target) // skip as needed { if (Min().SkipTo(target)) { Queue.UpdateTop(); } else { More = false; } } } return(More && (AtMatch() || Next())); }
public override bool LessThan(System.Object o1, System.Object o2) { SpansCell spans1 = (SpansCell)o1; SpansCell spans2 = (SpansCell)o2; if (spans1.Doc() == spans2.Doc()) { if (spans1.Start() == spans2.Start()) { if (spans1.End() == spans2.End()) { return(spans1.index > spans2.index); } else { return(spans1.End() < spans2.End()); } } else { return(spans1.Start() < spans2.Start()); } } else { return(spans1.Doc() < spans2.Doc()); } }
private void FirstToLast() { last.next = first; // move first to end of list last = first; first = first.next; last.next = null; }
private bool FirstNonOrderedNextToPartialList() { /* Creates a partial list consisting of first non ordered and earlier. * Returns first non ordered .next(). */ last = first = null; int orderedIndex = 0; while (queue.Top() != null) { SpansCell cell = (SpansCell)queue.Pop(); AddToList(cell); if (cell.index == orderedIndex) { orderedIndex++; } else { return(cell.Next()); // FIXME: continue here, rename to eg. checkOrderedMatch(): // when checkSlop() and not ordered, repeat cell.next(). // when checkSlop() and ordered, add to list and repeat queue.pop() // without checkSlop(): no match, rebuild the queue from the partial list. // When queue is empty and checkSlop() and ordered there is a match. } } throw new System.SystemException("Unexpected: ordered"); }
private void PartialListToQueue() { for (SpansCell cell = first; cell != null; cell = cell.next) { queue.Put(cell); // add to queue from list } }
private void FirstToLast() { Last.Next_Renamed = First; // move first to end of list Last = First; First = First.Next_Renamed; Last.Next_Renamed = null; }
public virtual bool SkipTo(int target) { if (firstTime) { // initialize InitList(false); for (SpansCell cell = first; more && cell != null; cell = cell.next) { more = cell.SkipTo(target); // skip all } if (more) { ListToQueue(); } firstTime = false; } else { // normal case while (more && Min().Doc() < target) { // skip as needed if (Min().SkipTo(target)) { queue.AdjustTop(); } else { more = false; } } } return(more && (AtMatch() || Next())); }
public override bool SkipTo(int target) { if (firstTime) // initialize { InitList(false); for (SpansCell cell = first; more && cell != null; cell = cell.next) { more = cell.SkipTo(target); // skip all } if (more) { ListToQueue(); } firstTime = false; } // normal case else { while (more && Min.Doc < target) // skip as needed { if (Min.SkipTo(target)) { queue.UpdateTop(); } else { more = false; } } } return(more && (AtMatch || Next())); }
private void ListToQueue() { queue.Clear(); // rebuild queue for (SpansCell cell = first; cell != null; cell = cell.next) { queue.Add(cell); // add to queue from list } }
private void QueueToList() { Last = First = null; while (Queue.Top() != null) { AddToList(Queue.Pop()); } }
private void QueueToList() { last = first = null; while (queue.Top != null) { AddToList(queue.Pop()); } }
private void ListToQueue() { Queue.Clear(); // rebuild queue for (SpansCell cell = First; cell != null; cell = cell.Next_Renamed) { Queue.Add(cell); // add to queue from list } }
// TODO: Remove warning after API has been finalized /// <summary> WARNING: The List is not necessarily in order of the the positions</summary> /// <returns> Collection of &lt;c&gt;byte[]&lt;/c&gt; payloads </returns> /// <throws> IOException </throws> public override ICollection <byte[]> GetPayload() { System.Collections.Generic.ISet <byte[]> matchPayload = Lucene.Net.Support.Compatibility.SetFactory.CreateHashSet <byte[]>(); for (SpansCell cell = first; cell != null; cell = cell.next) { if (cell.IsPayloadAvailable()) { matchPayload.UnionWith(cell.GetPayload()); } } return(matchPayload); }
private int totalLength; // sum of current lengths #endregion Fields #region Constructors public NearSpansUnordered(SpanNearQuery query, IndexReader reader) { this.query = query; this.slop = query.GetSlop(); SpanQuery[] clauses = query.GetClauses(); queue = new CellQueue(this, clauses.Length); for (int i = 0; i < clauses.Length; i++) { SpansCell cell = new SpansCell(this, clauses[i].GetPayloadSpans(reader), i); ordered.Add(cell); } }
private void AddToList(SpansCell cell) { if (last != null) // add next to end of list { last.next = cell; } else { first = cell; } last = cell; cell.next = null; }
private void AddToList(SpansCell cell) { if (Last != null) // add next to end of list { Last.Next_Renamed = cell; } else { First = cell; } Last = cell; cell.Next_Renamed = null; }
public NearSpansUnordered(SpanNearQuery query, IndexReader reader) { this.query = query; this.slop = query.GetSlop(); SpanQuery[] clauses = query.GetClauses(); queue = new CellQueue(this, clauses.Length); for (int i = 0; i < clauses.Length; i++) { SpansCell cell = new SpansCell(this, clauses[i].GetSpans(reader), i); ordered.Add(cell); } }
public bool IsPayloadAvailable() { SpansCell pointer = Min(); while (pointer != null) { if (pointer.IsPayloadAvailable()) { return(true); } pointer = pointer.next; } return(false); }
public override bool LessThan(System.Object o1, System.Object o2) { SpansCell spans1 = (SpansCell)o1; SpansCell spans2 = (SpansCell)o2; if (spans1.Doc() == spans2.Doc()) { return(NearSpansOrdered.DocSpansOrdered(spans1, spans2)); } else { return(spans1.Doc() < spans2.Doc()); } }
public NearSpans(SpanNearQuery query, IndexReader reader) { this.query = query; this.slop = query.GetSlop(); this.inOrder = query.IsInOrder(); SpanQuery[] clauses = query.GetClauses(); // initialize spans & list queue = new CellQueue(this, clauses.Length); for (int i = 0; i < clauses.Length; i++) { SpansCell cell = new SpansCell(this, clauses[i].GetSpans(reader), i); ordered.Add(cell); // add to ordered } }
private void InitList(bool next, IState state) { for (int i = 0; more && i < ordered.Count; i++) { SpansCell cell = ordered[i]; if (next) { more = cell.Next(state); // move to first entry } if (more) { AddToList(cell); // add to list } } }
public NearSpansUnordered(SpanNearQuery query, IndexReader reader, IState state) { this.query = query; this.slop = query.Slop; SpanQuery[] clauses = query.GetClauses(); queue = new CellQueue(this, clauses.Length); subSpans = new Spans[clauses.Length]; for (int i = 0; i < clauses.Length; i++) { SpansCell cell = new SpansCell(this, clauses[i].GetSpans(reader, state), i); ordered.Add(cell); subSpans[i] = cell.spans; } }
private void InitList(bool next) { for (int i = 0; More && i < Ordered.Count; i++) { SpansCell cell = Ordered[i]; if (next) { More = cell.Next(); // move to first entry } if (More) { AddToList(cell); // add to list } } }
public NearSpansUnordered(SpanNearQuery query, AtomicReaderContext context, Bits acceptDocs, IDictionary <Term, TermContext> termContexts) { this.Query = query; this.Slop = query.Slop; SpanQuery[] clauses = query.Clauses; Queue = new CellQueue(this, clauses.Length); subSpans = new Spans[clauses.Length]; for (int i = 0; i < clauses.Length; i++) { SpansCell cell = new SpansCell(this, clauses[i].GetSpans(context, acceptDocs, termContexts), i); Ordered.Add(cell); subSpans[i] = cell.Spans; } }
public ICollection <byte[]> GetPayload() { Dictionary <byte[], byte[]> matchPayload = new Dictionary <byte[], byte[]>(); for (SpansCell cell = first; cell != null; cell = cell.next) { if (cell.IsPayloadAvailable()) { for (IEnumerator <byte[]> e = cell.GetPayload().GetEnumerator(); e.MoveNext();) { matchPayload[e.Current] = e.Current; } } } return(matchPayload.Keys); }
// TODO: Remove warning after API has been finalized /// <summary> WARNING: The List is not necessarily in order of the the positions</summary> /// <returns> Collection of <code>byte[]</code> payloads /// </returns> /// <throws> IOException </throws> public override System.Collections.Generic.ICollection <byte[]> GetPayload() { //mgarski: faking out another HashSet<T>... System.Collections.Generic.Dictionary <byte[], byte[]> matchPayload = new System.Collections.Generic.Dictionary <byte[], byte[]>(); for (SpansCell cell = first; cell != null; cell = cell.next) { if (cell.IsPayloadAvailable()) { System.Collections.Generic.ICollection <byte[]> cellPayload = cell.GetPayload(); foreach (byte[] val in cellPayload) { if (!matchPayload.ContainsKey(val)) { matchPayload.Add(val, val); } } } } return(matchPayload.Keys); }
private void QueueToList() { last = first = null; while (queue.Top() != null) { AddToList((SpansCell) queue.Pop()); } }
public NearSpans(SpanNearQuery query, Monodoc.Lucene.Net.Index.IndexReader reader) { this.query = query; this.slop = query.GetSlop(); this.inOrder = query.IsInOrder(); SpanQuery[] clauses = query.GetClauses(); // initialize spans & list queue = new CellQueue(this, clauses.Length); for (int i = 0; i < clauses.Length; i++) { SpansCell cell = new SpansCell(this, clauses[i].GetSpans(reader), i); ordered.Add(cell); // add to ordered } }
private bool FirstNonOrderedNextToPartialList() { /* Creates a partial list consisting of first non ordered and earlier. * Returns first non ordered .next(). */ last = first = null; int orderedIndex = 0; while (queue.Top() != null) { SpansCell cell = (SpansCell) queue.Pop(); AddToList(cell); if (cell.index == orderedIndex) { orderedIndex++; } else { return cell.Next(); // FIXME: continue here, rename to eg. checkOrderedMatch(): // when checkSlop() and not ordered, repeat cell.next(). // when checkSlop() and ordered, add to list and repeat queue.pop() // without checkSlop(): no match, rebuild the queue from the partial list. // When queue is empty and checkSlop() and ordered there is a match. } } throw new System.SystemException("Unexpected: ordered"); }
private void AddToList(SpansCell cell) { if (last != null) { // add next to end of list last.next = cell; } else first = cell; last = cell; cell.next = null; }