01: package org.apache.lucene.index;
02:
03: /**
04: * Licensed to the Apache Software Foundation (ASF) under one or more
05: * contributor license agreements. See the NOTICE file distributed with
06: * this work for additional information regarding copyright ownership.
07: * The ASF licenses this file to You under the Apache License, Version 2.0
08: * (the "License"); you may not use this file except in compliance with
09: * the License. You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: */
19:
20: /** Provides access to stored term vector of
21: * a document field. The vector consists of the name of the field, an array of the terms tha occur in the field of the
22: * {@link org.apache.lucene.document.Document} and a parallel array of frequencies. Thus, getTermFrequencies()[5] corresponds with the
23: * frequency of getTerms()[5], assuming there are at least 5 terms in the Document.
24: */
25: public interface TermFreqVector {
26: /**
27: * The {@link org.apache.lucene.document.Fieldable} name.
28: * @return The name of the field this vector is associated with.
29: *
30: */
31: public String getField();
32:
33: /**
34: * @return The number of terms in the term vector.
35: */
36: public int size();
37:
38: /**
39: * @return An Array of term texts in ascending order.
40: */
41: public String[] getTerms();
42:
43: /** Array of term frequencies. Locations of the array correspond one to one
44: * to the terms in the array obtained from <code>getTerms</code>
45: * method. Each location in the array contains the number of times this
46: * term occurs in the document or the document field.
47: */
48: public int[] getTermFrequencies();
49:
50: /** Return an index in the term numbers array returned from
51: * <code>getTerms</code> at which the term with the specified
52: * <code>term</code> appears. If this term does not appear in the array,
53: * return -1.
54: */
55: public int indexOf(String term);
56:
57: /** Just like <code>indexOf(int)</code> but searches for a number of terms
58: * at the same time. Returns an array that has the same size as the number
59: * of terms searched for, each slot containing the result of searching for
60: * that term number.
61: *
62: * @param terms array containing terms to look for
63: * @param start index in the array where the list of terms starts
64: * @param len the number of terms in the list
65: */
66: public int[] indexesOf(String[] terms, int start, int len);
67:
68: }
|