KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lucene > index > TermFreqVector


1 package org.apache.lucene.index;
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 /** Provides access to stored term vector of
20  * a document field.
21  */

22 public interface TermFreqVector {
23   /**
24    *
25    * @return The field this vector is associated with.
26    *
27    */

28   public String JavaDoc getField();
29   
30   /**
31    * @return The number of terms in the term vector.
32    */

33   public int size();
34
35   /**
36    * @return An Array of term texts in ascending order.
37    */

38   public String JavaDoc[] getTerms();
39
40
41   /** Array of term frequencies. Locations of the array correspond one to one
42    * to the terms in the array obtained from <code>getTerms</code>
43    * method. Each location in the array contains the number of times this
44    * term occurs in the document or the document field.
45    */

46   public int[] getTermFrequencies();
47   
48
49   /** Return an index in the term numbers array returned from
50    * <code>getTerms</code> at which the term with the specified
51    * <code>term</code> appears. If this term does not appear in the array,
52    * return -1.
53    */

54   public int indexOf(String JavaDoc term);
55
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 JavaDoc[] terms, int start, int len);
67
68 }
69
Popular Tags