org.apache.lucene.index.memory
static final class: MemoryIndex.Info [javadoc |
source]
java.lang.Object
org.apache.lucene.index.memory.MemoryIndex$Info
All Implemented Interfaces:
Serializable
Index data structure for a field; Contains the tokenized term texts and
their positions.
| Field Summary |
|---|
| public transient Term | template | Term for this field's fieldName, lazily computed on demand |
| Constructor: |
public Info(HashMap terms,
int numTokens,
float boost) {
this.terms = terms;
this.numTokens = numTokens;
this.boost = boost;
}
|
| Method from org.apache.lucene.index.memory.MemoryIndex$Info Detail: |
public float getBoost() {
return boost;
}
|
public MemoryIndex.ArrayIntList getPositions(String term) {
return (ArrayIntList) terms.get(term);
}
note that the frequency can be calculated as numPosition(getPositions(x)) |
public MemoryIndex.ArrayIntList getPositions(int pos) {
return (ArrayIntList) sortedTerms[pos].getValue();
}
note that the frequency can be calculated as numPosition(getPositions(x)) |
public void sortTerms() {
if (sortedTerms == null) sortedTerms = sort(terms);
}
Sorts hashed terms into ascending order, reusing memory along the
way. Note that sorting is lazily delayed until required (often it's
not required at all). If a sorted view is required then hashing +
sort + binary search is still faster and smaller than TreeMap usage
(which would be an alternative and somewhat more elegant approach,
apart from more sophisticated Tries / prefix trees). |