pylucene 3.5.0-3
[pylucene.git] / lucene-java-3.5.0 / lucene / src / java / org / apache / lucene / search / SpanFilter.java
1 package org.apache.lucene.search;
2 /**
3  * Copyright 2007 The Apache Software Foundation
4  *
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
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 import org.apache.lucene.index.IndexReader;
19
20 import java.io.IOException;
21
22 /** Abstract base class providing a mechanism to restrict searches to a subset
23  of an index and also maintains and returns position information.
24
25  This is useful if you want to compare the positions from a SpanQuery with the positions of items in
26  a filter.  For instance, if you had a SpanFilter that marked all the occurrences of the word "foo" in documents,
27  and then you entered a new SpanQuery containing bar, you could not only filter by the word foo, but you could
28  then compare position information for post processing.
29  */
30 public abstract class SpanFilter extends Filter{
31   /** Returns a SpanFilterResult with true for documents which should be permitted in
32     search results, and false for those that should not and Spans for where the true docs match.
33    * @param reader The {@link org.apache.lucene.index.IndexReader} to load position and DocIdSet information from
34    * @return A {@link SpanFilterResult}
35    * @throws java.io.IOException if there was an issue accessing the necessary information
36    * */
37   public abstract SpanFilterResult bitSpans(IndexReader reader) throws IOException;
38 }