Exemplo n.º 1
0
        public NearSpansOrdered(SpanNearQuery spanNearQuery, AtomicReaderContext context, IBits acceptDocs, IDictionary <Term, TermContext> termContexts, bool collectPayloads)
        {
            // LUCENENET: Added guard clauses for null
            if (spanNearQuery is null)
            {
                throw new ArgumentNullException(nameof(spanNearQuery));
            }

            sorter = new InPlaceMergeSorterAnonymousClass(this);
            if (spanNearQuery.GetClauses().Length < 2)
            {
                throw new ArgumentException("Less than 2 clauses: " + spanNearQuery);
            }
            this.collectPayloads = collectPayloads;
            allowedSlop          = spanNearQuery.Slop;
            SpanQuery[] clauses = spanNearQuery.GetClauses();
            subSpans      = new Spans[clauses.Length];
            matchPayload  = new List <byte[]>();
            subSpansByDoc = new Spans[clauses.Length];
            for (int i = 0; i < clauses.Length; i++)
            {
                subSpans[i]      = clauses[i].GetSpans(context, acceptDocs, termContexts);
                subSpansByDoc[i] = subSpans[i]; // used in toSameDoc()
            }
            query = spanNearQuery;              // kept for toString() only.
        }
Exemplo n.º 2
0
 public NearSpansOrdered(SpanNearQuery spanNearQuery, IndexReader reader)
 {
     InitBlock();
     if (spanNearQuery.GetClauses().Length < 2)
     {
         throw new System.ArgumentException("Less than 2 clauses: " + spanNearQuery);
     }
     allowedSlop = spanNearQuery.GetSlop();
     SpanQuery[] clauses = spanNearQuery.GetClauses();
     subSpans      = new Spans[clauses.Length];
     subSpansByDoc = new Spans[clauses.Length];
     for (int i = 0; i < clauses.Length; i++)
     {
         subSpans[i]      = clauses[i].GetSpans(reader);
         subSpansByDoc[i] = subSpans[i]; // used in toSameDoc()
     }
     query = spanNearQuery;              // kept for toString() only.
 }
 public NearSpansOrdered(SpanNearQuery spanNearQuery, IndexReader reader)
 {
     InitBlock();
     if (spanNearQuery.GetClauses().Length < 2)
     {
         throw new System.ArgumentException("Less than 2 clauses: " + spanNearQuery);
     }
     allowedSlop = spanNearQuery.GetSlop();
     SpanQuery[] clauses = spanNearQuery.GetClauses();
     subSpans = new PayloadSpans[clauses.Length];
     matchPayload = new List<byte[]>();
     subSpansByDoc = new PayloadSpans[clauses.Length];
     for (int i = 0; i < clauses.Length; i++)
     {
         subSpans[i] = clauses[i].GetPayloadSpans(reader);
         subSpansByDoc[i] = subSpans[i]; // used in toSameDoc()
     }
     query = spanNearQuery; // kept for toString() only.
 }
Exemplo n.º 4
0
 public NearSpansOrdered(SpanNearQuery spanNearQuery, IndexReader reader, bool collectPayloads)
 {
     if (spanNearQuery.GetClauses().Length < 2)
     {
         throw new System.ArgumentException("Less than 2 clauses: " + spanNearQuery);
     }
     this.collectPayloads = collectPayloads;
     allowedSlop          = spanNearQuery.GetSlop();
     SpanQuery[] clauses = spanNearQuery.GetClauses();
     subSpans      = new Spans[clauses.Length];
     matchPayload  = new List <byte[]>();
     subSpansByDoc = new Spans[clauses.Length];
     for (int i = 0; i < clauses.Length; i++)
     {
         subSpans[i]      = clauses[i].GetSpans(reader);
         subSpansByDoc[i] = subSpans[i]; // used in toSameDoc()
     }
     query = spanNearQuery;              // kept for toString() only.
 }
Exemplo n.º 5
0
        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);
            }
        }
        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);
            }
        }
Exemplo n.º 7
0
        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
            }
        }
Exemplo n.º 8
0
        public NearSpansUnordered(SpanNearQuery query, AtomicReaderContext context, IBits acceptDocs, IDictionary <Term, TermContext> termContexts)
        {
            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(context, acceptDocs, termContexts), i);
                ordered.Add(cell);
                subSpans[i] = cell.spans;
            }
        }
Exemplo n.º 9
0
        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 static void VisitQuery(SpanNearQuery query, AzureQueryLogger.IndentedTextWriter writer)
 {
     writer.WriteLine("IsInOrder: {0}", (query.IsInOrder ? 1 : 0));
     writer.WriteLine("Slop: {0}", (object)query.Slop);
     AzureQueryLogger.VisitClauses(writer, query.GetClauses());
 }
Exemplo n.º 11
0
		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
			}
		}