public NearSpansOrdered(SpanNearQuery spanNearQuery, IndexReader reader) throws IOException { if (spanNearQuery.getClauses().length < 2) { throw new IllegalArgumentException("Less than 2 clauses: " + spanNearQuery); } allowedSlop = spanNearQuery.getSlop(); SpanQuery[] clauses = spanNearQuery.getClauses(); subSpans = new PayloadSpans[clauses.length]; matchPayload = new LinkedList(); 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. }
public NearSpans(SpanNearQuery query, IndexReader reader) throws IOException { this.query = query; this.slop = query.getSlop(); this.inOrder = query.isInOrder(); SpanQuery[] clauses = query.getClauses(); // initialize spans & list queue = new CellQueue(clauses.length); for (int i = 0; i < clauses.length; i++) { SpansCell cell = // construct clause spans new SpansCell(clauses[i].getSpans(reader), i); ordered.add(cell); // add to ordered } }