Package org.apache.lucene.index
Class PositionBasedTermVectorMapper
- java.lang.Object
-
- org.apache.lucene.index.TermVectorMapper
-
- 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
Nested Classes Modifier and Type Class Description static class
PositionBasedTermVectorMapper.TVPositionInfo
Container for a term at a position
-
Constructor Summary
Constructors Constructor Description PositionBasedTermVectorMapper()
PositionBasedTermVectorMapper(boolean ignoringOffsets)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Map<Integer,PositionBasedTermVectorMapper.TVPositionInfo>>
getFieldToTerms()
Get the mapping between fields and terms, sorted by the comparatorboolean
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
-
-
-
-
Method Detail
-
isIgnoringPositions
public boolean isIgnoringPositions()
Never ignores positions. This mapper doesn't make much sense unless there are positions- Overrides:
isIgnoringPositions
in classTermVectorMapper
- Returns:
- false
-
map
public void map(String term, int frequency, TermVectorOffsetInfo[] offsets, int[] positions)
Callback for the TermVectorReader.- Specified by:
map
in classTermVectorMapper
- 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 classTermVectorMapper
- Parameters:
field
- The field being readnumTerms
- The number of terms in the vectorstoreOffsets
- Whether offsets are availablestorePositions
- 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
.
-
-