org.apache.lucene.index
Class SegmentTermPositionVector

java.lang.Object
  extended by org.apache.lucene.index.SegmentTermPositionVector
All Implemented Interfaces:
TermFreqVector, TermPositionVector

public class SegmentTermPositionVector
extends java.lang.Object
implements TermPositionVector

Copyright 2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Field Summary
static int[] EMPTY_TERM_POS
           
protected  TermVectorOffsetInfo[][] offsets
           
protected  int[][] positions
           
 
Constructor Summary
SegmentTermPositionVector(java.lang.String field, java.lang.String[] terms, int[] termFreqs, int[][] positions, TermVectorOffsetInfo[][] offsets)
           
 
Method Summary
 java.lang.String getField()
           
 TermVectorOffsetInfo[] getOffsets(int index)
          Returns an array of TermVectorOffsetInfo in which the term is found.
 int[] getTermFrequencies()
          Array of term frequencies.
 int[] getTermPositions(int index)
          Returns an array of positions in which the term is found.
 java.lang.String[] getTerms()
           
 int[] indexesOf(java.lang.String[] termNumbers, int start, int len)
          Just like indexOf(int) but searches for a number of terms at the same time.
 int indexOf(java.lang.String termText)
          Return an index in the term numbers array returned from getTerms at which the term with the specified term appears.
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.lucene.index.TermFreqVector
getField, getTermFrequencies, getTerms, indexesOf, indexOf, size
 

Field Detail

positions

protected int[][] positions

offsets

protected TermVectorOffsetInfo[][] offsets

EMPTY_TERM_POS

public static final int[] EMPTY_TERM_POS
Constructor Detail

SegmentTermPositionVector

public SegmentTermPositionVector(java.lang.String field,
                                 java.lang.String[] terms,
                                 int[] termFreqs,
                                 int[][] positions,
                                 TermVectorOffsetInfo[][] offsets)
Method Detail

getOffsets

public TermVectorOffsetInfo[] getOffsets(int index)
Returns an array of TermVectorOffsetInfo in which the term is found.

Specified by:
getOffsets in interface TermPositionVector
Parameters:
index - The position in the array to get the offsets from
Returns:
An array of TermVectorOffsetInfo objects or the empty list
See Also:
Token

getTermPositions

public int[] getTermPositions(int index)
Returns an array of positions in which the term is found. Terms are identified by the index at which its number appears in the term String array obtained from the indexOf method.

Specified by:
getTermPositions in interface TermPositionVector

getField

public java.lang.String getField()
Specified by:
getField in interface TermFreqVector
Returns:
The number of the field this vector is associated with

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

size

public int size()
Specified by:
size in interface TermFreqVector
Returns:
The number of terms in the term vector.

getTerms

public java.lang.String[] getTerms()
Specified by:
getTerms in interface TermFreqVector
Returns:
An Array of term texts in ascending order.

getTermFrequencies

public int[] getTermFrequencies()
Description copied from interface: TermFreqVector
Array of term frequencies. Locations of the array correspond one to one to the terms in the array obtained from getTerms method. Each location in the array contains the number of times this term occurs in the document or the document field.

Specified by:
getTermFrequencies in interface TermFreqVector

indexOf

public int indexOf(java.lang.String termText)
Description copied from interface: TermFreqVector
Return an index in the term numbers array returned from getTerms at which the term with the specified term appears. If this term does not appear in the array, return -1.

Specified by:
indexOf in interface TermFreqVector

indexesOf

public int[] indexesOf(java.lang.String[] termNumbers,
                       int start,
                       int len)
Description copied from interface: TermFreqVector
Just like indexOf(int) but searches for a number of terms at the same time. Returns an array that has the same size as the number of terms searched for, each slot containing the result of searching for that term number.

Specified by:
indexesOf in interface TermFreqVector
Parameters:
termNumbers - array containing terms to look for
start - index in the array where the list of terms starts
len - the number of terms in the list


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.