add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / src / java / org / apache / lucene / index / TermFreqVector.java
1 package org.apache.lucene.index;
2
3 /**
4  * Licensed to the Apache Software Foundation (ASF) under one or more
5  * contributor license agreements.  See the NOTICE file distributed with
6  * this work for additional information regarding copyright ownership.
7  * The ASF licenses this file to You under the Apache License, Version 2.0
8  * (the "License"); you may not use this file except in compliance with
9  * 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 that 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
44   /** Array of term frequencies. Locations of the array correspond one to one
45    *  to the terms in the array obtained from <code>getTerms</code>
46    *  method. Each location in the array contains the number of times this
47    *  term occurs in the document or the document field.
48    */
49   public int[] getTermFrequencies();
50   
51
52   /** Return an index in the term numbers array returned from
53    *  <code>getTerms</code> at which the term with the specified
54    *  <code>term</code> appears. If this term does not appear in the array,
55    *  return -1.
56    */
57   public int indexOf(String term);
58
59
60   /** Just like <code>indexOf(int)</code> but searches for a number of terms
61    *  at the same time. Returns an array that has the same size as the number
62    *  of terms searched for, each slot containing the result of searching for
63    *  that term number.
64    *
65    *  @param terms array containing terms to look for
66    *  @param start index in the array where the list of terms starts
67    *  @param len the number of terms in the list
68    */
69   public int[] indexesOf(String[] terms, int start, int len);
70
71 }