org.apache.lucene.index
Class PositionBasedTermVectorMapper

java.lang.Object
  extended by org.apache.lucene.index.TermVectorMapper
      extended by org.apache.lucene.index.PositionBasedTermVectorMapper

public class PositionBasedTermVectorMapper
extends TermVectorMapper

For each Field, store position by position information. It ignores frequency information

This is not thread-safe.


Nested Class Summary
static class PositionBasedTermVectorMapper.TVPositionInfo
          Container for a term at a position
 
Constructor Summary
PositionBasedTermVectorMapper()
           
PositionBasedTermVectorMapper(boolean ignoringOffsets)
           
 
Method Summary
 Map<String,Map<Integer,PositionBasedTermVectorMapper.TVPositionInfo>> getFieldToTerms()
          Get the mapping between fields and terms, sorted by the comparator
 boolean isIgnoringPositions()
          Never ignores positions.
 void map(String term, int frequency, TermVectorOffsetInfo[] offsets, int[] positions)
          Callback for the TermVectorReader.
 void setExpectations(String field, int numTerms, boolean storeOffsets, boolean storePositions)
          Callback mechanism used by the TermVectorReader
 
Methods inherited from class org.apache.lucene.index.TermVectorMapper
isIgnoringOffsets, setDocumentNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PositionBasedTermVectorMapper

public PositionBasedTermVectorMapper()

PositionBasedTermVectorMapper

public PositionBasedTermVectorMapper(boolean ignoringOffsets)
Method Detail

isIgnoringPositions

public boolean isIgnoringPositions()
Never ignores positions. This mapper doesn't make much sense unless there are positions

Overrides:
isIgnoringPositions in class TermVectorMapper
Returns:
false

map

public void map(String term,
                int frequency,
                TermVectorOffsetInfo[] offsets,
                int[] positions)
Callback for the TermVectorReader.

Specified by:
map in class TermVectorMapper
Parameters:
term -
frequency -
offsets -
positions -

setExpectations

public void setExpectations(String field,
                            int numTerms,
                            boolean storeOffsets,
                            boolean storePositions)
Callback mechanism used by the TermVectorReader

Specified by:
setExpectations in class TermVectorMapper
Parameters:
field - The field being read
numTerms - The number of terms in the vector
storeOffsets - Whether offsets are available
storePositions - Whether positions are available

getFieldToTerms

public Map<String,Map<Integer,PositionBasedTermVectorMapper.TVPositionInfo>> getFieldToTerms()
Get the mapping between fields and terms, sorted by the comparator

Returns:
A map between field names and a Map. The sub-Map key is the position as the integer, the value is PositionBasedTermVectorMapper.TVPositionInfo.


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