01: package org.apache.lucene.search;
02:
03: /**
04: * Copyright 2007 The Apache Software Foundation
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import org.apache.lucene.index.IndexReader;
20:
21: import java.io.IOException;
22:
23: /** Abstract base class providing a mechanism to restrict searches to a subset
24: of an index and also maintains and returns position information.
25:
26: This is useful if you want to compare the positions from a SpanQuery with the positions of items in
27: a filter. For instance, if you had a SpanFilter that marked all the occurrences of the word "foo" in documents,
28: and then you entered a new SpanQuery containing bar, you could not only filter by the word foo, but you could
29: then compare position information for post processing.
30: */
31: public abstract class SpanFilter extends Filter {
32: /** Returns a SpanFilterResult with true for documents which should be permitted in
33: search results, and false for those that should not and Spans for where the true docs match.
34: * @param reader The {@link org.apache.lucene.index.IndexReader} to load position and bitset information from
35: * @return A {@link SpanFilterResult}
36: * @throws java.io.IOException if there was an issue accessing the necessary information
37: * */
38: public abstract SpanFilterResult bitSpans(IndexReader reader)
39: throws IOException;
40: }
|