Package org.apache.lucene.index
Class FieldSortedTermVectorMapper
- java.lang.Object
-
- org.apache.lucene.index.TermVectorMapper
-
- org.apache.lucene.index.FieldSortedTermVectorMapper
-
public class FieldSortedTermVectorMapper extends TermVectorMapper
For each Field, store a sorted collection ofTermVectorEntry
s This is not thread-safe.
-
-
Constructor Summary
Constructors Constructor Description FieldSortedTermVectorMapper(boolean ignoringPositions, boolean ignoringOffsets, Comparator<TermVectorEntry> comparator)
FieldSortedTermVectorMapper(Comparator<TermVectorEntry> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Comparator<TermVectorEntry>
getComparator()
Map<String,SortedSet<TermVectorEntry>>
getFieldToTerms()
Get the mapping between fields and terms, sorted by the comparatorvoid
map(String term, int frequency, TermVectorOffsetInfo[] offsets, int[] positions)
Map the Term Vector information into your own structurevoid
setExpectations(String field, int numTerms, boolean storeOffsets, boolean storePositions)
Tell the mapper what to expect in regards to field, number of terms, offset and position storage.-
Methods inherited from class org.apache.lucene.index.TermVectorMapper
isIgnoringOffsets, isIgnoringPositions, setDocumentNumber
-
-
-
-
Constructor Detail
-
FieldSortedTermVectorMapper
public FieldSortedTermVectorMapper(Comparator<TermVectorEntry> comparator)
- Parameters:
comparator
- A Comparator for sortingTermVectorEntry
s
-
FieldSortedTermVectorMapper
public FieldSortedTermVectorMapper(boolean ignoringPositions, boolean ignoringOffsets, Comparator<TermVectorEntry> comparator)
-
-
Method Detail
-
map
public void map(String term, int frequency, TermVectorOffsetInfo[] offsets, int[] positions)
Description copied from class:TermVectorMapper
Map the Term Vector information into your own structure- Specified by:
map
in classTermVectorMapper
- Parameters:
term
- The term to add to the vectorfrequency
- The frequency of the term in the documentoffsets
- null if the offset is not specified, otherwise the offset into the field of the termpositions
- null if the position is not specified, otherwise the position in the field of the term
-
setExpectations
public void setExpectations(String field, int numTerms, boolean storeOffsets, boolean storePositions)
Description copied from class:TermVectorMapper
Tell the mapper what to expect in regards to field, number of terms, offset and position storage. This method will be called once before retrieving the vector for a field. This method will be called beforeTermVectorMapper.map(String,int,TermVectorOffsetInfo[],int[])
.- Specified by:
setExpectations
in classTermVectorMapper
- Parameters:
field
- The field the vector is fornumTerms
- The number of terms that need to be mappedstoreOffsets
- true if the mapper should expect offset informationstorePositions
- true if the mapper should expect positions info
-
getFieldToTerms
public Map<String,SortedSet<TermVectorEntry>> getFieldToTerms()
Get the mapping between fields and terms, sorted by the comparator- Returns:
- A map between field names and
SortedSet
s per field. SortedSet entries areTermVectorEntry
-
getComparator
public Comparator<TermVectorEntry> getComparator()
-
-