public class OrdinalMap extends java.lang.Object implements Accountable
NOTE: this is a costly operation, as it must merge sort all terms, and may require non-trivial RAM once done. It's better to operate in segment-private ordinal space instead when possible.
Modifier and Type | Class and Description |
---|---|
private static class |
OrdinalMap.SegmentMap |
private static class |
OrdinalMap.TermsEnumIndex |
Modifier and Type | Field and Description |
---|---|
private static long |
BASE_RAM_BYTES_USED |
(package private) PackedLongValues |
firstSegments |
(package private) PackedLongValues |
globalOrdDeltas |
IndexReader.CacheKey |
owner
Cache key of whoever asked for this awful thing
|
(package private) long |
ramBytesUsed |
(package private) OrdinalMap.SegmentMap |
segmentMap |
(package private) LongValues[] |
segmentToGlobalOrds |
Constructor and Description |
---|
OrdinalMap(IndexReader.CacheKey owner,
TermsEnum[] subs,
OrdinalMap.SegmentMap segmentMap,
float acceptableOverheadRatio) |
Modifier and Type | Method and Description |
---|---|
static OrdinalMap |
build(IndexReader.CacheKey owner,
SortedDocValues[] values,
float acceptableOverheadRatio)
Create an ordinal map that uses the number of unique values of each
SortedDocValues instance as a weight. |
static OrdinalMap |
build(IndexReader.CacheKey owner,
SortedSetDocValues[] values,
float acceptableOverheadRatio)
Create an ordinal map that uses the number of unique values of each
SortedSetDocValues instance as a weight. |
static OrdinalMap |
build(IndexReader.CacheKey owner,
TermsEnum[] subs,
long[] weights,
float acceptableOverheadRatio)
Creates an ordinal map that allows mapping ords to/from a merged
space from
subs . |
java.util.Collection<Accountable> |
getChildResources()
Returns nested resources of this class.
|
int |
getFirstSegmentNumber(long globalOrd)
Given a global ordinal, returns the index of the first
segment that contains this term.
|
long |
getFirstSegmentOrd(long globalOrd)
Given global ordinal, returns the ordinal of the first segment which contains
this ordinal (the corresponding to the segment return
getFirstSegmentNumber(long) ). |
LongValues |
getGlobalOrds(int segmentIndex)
Given a segment number, return a
LongValues instance that maps
segment ordinals to global ordinals. |
long |
getValueCount()
Returns the total number of unique terms in global ord space.
|
long |
ramBytesUsed()
Return the memory usage of this object in bytes.
|
private static final long BASE_RAM_BYTES_USED
public final IndexReader.CacheKey owner
final PackedLongValues globalOrdDeltas
final PackedLongValues firstSegments
final LongValues[] segmentToGlobalOrds
final OrdinalMap.SegmentMap segmentMap
final long ramBytesUsed
OrdinalMap(IndexReader.CacheKey owner, TermsEnum[] subs, OrdinalMap.SegmentMap segmentMap, float acceptableOverheadRatio) throws java.io.IOException
java.io.IOException
public static OrdinalMap build(IndexReader.CacheKey owner, SortedDocValues[] values, float acceptableOverheadRatio) throws java.io.IOException
SortedDocValues
instance as a weight.java.io.IOException
build(IndexReader.CacheKey, TermsEnum[], long[], float)
public static OrdinalMap build(IndexReader.CacheKey owner, SortedSetDocValues[] values, float acceptableOverheadRatio) throws java.io.IOException
SortedSetDocValues
instance as a weight.java.io.IOException
build(IndexReader.CacheKey, TermsEnum[], long[], float)
public static OrdinalMap build(IndexReader.CacheKey owner, TermsEnum[] subs, long[] weights, float acceptableOverheadRatio) throws java.io.IOException
subs
.owner
- a cache keysubs
- TermsEnums that support TermsEnum.ord()
. They need
not be dense (e.g. can be FilteredTermsEnums}.weights
- a weight for each sub. This is ideally correlated with
the number of unique terms that each sub introduces compared
to the other subsjava.io.IOException
- if an I/O error occurred.public LongValues getGlobalOrds(int segmentIndex)
LongValues
instance that maps
segment ordinals to global ordinals.public long getFirstSegmentOrd(long globalOrd)
getFirstSegmentNumber(long)
).public int getFirstSegmentNumber(long globalOrd)
public long getValueCount()
public long ramBytesUsed()
Accountable
ramBytesUsed
in interface Accountable
public java.util.Collection<Accountable> getChildResources()
Accountable
getChildResources
in interface Accountable
Accountables