KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lucene > search > spans > SpanQuery


1 package org.apache.lucene.search.spans;
2
3 /**
4  * Copyright 2004 The Apache Software Foundation
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
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 java.io.IOException JavaDoc;
20
21 import java.util.Collection JavaDoc;
22
23 import org.apache.lucene.index.IndexReader;
24 import org.apache.lucene.search.Query;
25 import org.apache.lucene.search.Weight;
26 import org.apache.lucene.search.Searcher;
27
28 /** Base class for span-based queries. */
29 public abstract class SpanQuery extends Query {
30   /** Expert: Returns the matches for this query in an index. Used internally
31    * to search for spans. */

32   public abstract Spans getSpans(IndexReader reader) throws IOException JavaDoc;
33
34   /** Returns the name of the field matched by this query.*/
35   public abstract String JavaDoc getField();
36
37   /** Returns a collection of all terms matched by this query.*/
38   public abstract Collection JavaDoc getTerms();
39
40   protected Weight createWeight(Searcher searcher) throws IOException JavaDoc {
41     return new SpanWeight(this, searcher);
42   }
43
44 }
45
46
Popular Tags