1 package org.apache.lucene.search;
3 * Copyright 2005 The Apache Software Foundation
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 import java.util.ArrayList;
20 import java.util.List;
24 * The results of a SpanQueryFilter. Wraps the BitSet and the position information from the SpanQuery
26 * @lucene.experimental
29 public class SpanFilterResult {
30 private DocIdSet docIdSet;
31 private List<PositionInfo> positions;//Spans spans;
35 * @param docIdSet The DocIdSet for the Filter
36 * @param positions A List of {@link org.apache.lucene.search.SpanFilterResult.PositionInfo} objects
38 public SpanFilterResult(DocIdSet docIdSet, List<PositionInfo> positions) {
39 this.docIdSet = docIdSet;
40 this.positions = positions;
44 * The first entry in the array corresponds to the first "on" bit.
45 * Entries are increasing by document order
46 * @return A List of PositionInfo objects
48 public List<PositionInfo> getPositions() {
52 /** Returns the docIdSet */
53 public DocIdSet getDocIdSet() {
57 public static class PositionInfo {
59 private List<StartEnd> positions;
62 public PositionInfo(int doc) {
64 positions = new ArrayList<StartEnd>();
67 public void addPosition(int start, int end)
69 positions.add(new StartEnd(start, end));
80 public List<StartEnd> getPositions() {
85 public static class StartEnd
91 public StartEnd(int start, int end) {
98 * @return The end position of this match
100 public int getEnd() {
106 * @return The start position of this match
108 public int getStart() {