1
package org.apache.lucene.index;
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
11
* http://www.apache.org/licenses/LICENSE-2.0
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.
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.
25
public interface TermFreqVector {
27
* The {@link org.apache.lucene.document.Fieldable} name.
28
* @return The name of the field this vector is associated with.
31
public String getField();
34
* @return The number of terms in the term vector.
39
* @return An Array of term texts in ascending order.
41
public String[] getTerms();
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.
49
public int[] getTermFrequencies();
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,
57
public int indexOf(String term);
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
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
69
public int[] indexesOf(String[] terms, int start, int len);