Package org.apache.lucene.index
Class SortedTermVectorMapper
- java.lang.Object
-
- org.apache.lucene.index.TermVectorMapper
-
- org.apache.lucene.index.SortedTermVectorMapper
-
public class SortedTermVectorMapper extends TermVectorMapper
Store a sorted collection ofTermVectorEntry
s. Collects all term information into a single, SortedSet.
NOTE: This Mapper ignores all Field information for the Document. This means that if you are using offset/positions you will not know what Fields they correlate with.
This is not thread-safe
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALL
Stand-in name for the field inTermVectorEntry
.
-
Constructor Summary
Constructors Constructor Description SortedTermVectorMapper(boolean ignoringPositions, boolean ignoringOffsets, Comparator<TermVectorEntry> comparator)
SortedTermVectorMapper(Comparator<TermVectorEntry> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SortedSet<TermVectorEntry>
getTermVectorEntrySet()
The TermVectorEntrySet.void
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
-
-
-
-
Field Detail
-
ALL
public static final String ALL
Stand-in name for the field inTermVectorEntry
.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SortedTermVectorMapper
public SortedTermVectorMapper(Comparator<TermVectorEntry> comparator)
- Parameters:
comparator
- A Comparator for sortingTermVectorEntry
s
-
SortedTermVectorMapper
public SortedTermVectorMapper(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 mapfrequency
- The frequency of the termoffsets
- Offset information, may be nullpositions
- Position information, may be null
-
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
-
getTermVectorEntrySet
public SortedSet<TermVectorEntry> getTermVectorEntrySet()
The TermVectorEntrySet. A SortedSet ofTermVectorEntry
objects. Sort is by the comparator passed into the constructor.
This set will be empty until after the mapping process takes place.- Returns:
- The SortedSet of
TermVectorEntry
.
-
-