本文整理汇总了Java中org.apache.lucene.util.LongValues类的典型用法代码示例。如果您正苦于以下问题:Java LongValues类的具体用法?Java LongValues怎么用?Java LongValues使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongValues类属于org.apache.lucene.util包,在下文中一共展示了LongValues类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getInstance
import org.apache.lucene.util.LongValues; //导入依赖的package包/类
/**
* Retrieves an instance from the specified slice written decoding
* {@code bitsPerValue} for each value
*/
public static LongValues getInstance(RandomAccessInput slice, int bitsPerValue) {
switch (bitsPerValue) {
case 1: return new DirectPackedReader1(slice);
case 2: return new DirectPackedReader2(slice);
case 4: return new DirectPackedReader4(slice);
case 8: return new DirectPackedReader8(slice);
case 12: return new DirectPackedReader12(slice);
case 16: return new DirectPackedReader16(slice);
case 20: return new DirectPackedReader20(slice);
case 24: return new DirectPackedReader24(slice);
case 28: return new DirectPackedReader28(slice);
case 32: return new DirectPackedReader32(slice);
case 40: return new DirectPackedReader40(slice);
case 48: return new DirectPackedReader48(slice);
case 56: return new DirectPackedReader56(slice);
case 64: return new DirectPackedReader64(slice);
default: throw new IllegalArgumentException("unsupported bitsPerValue: " + bitsPerValue);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:DirectReader.java
示例2: accumMultiGeneric
import org.apache.lucene.util.LongValues; //导入依赖的package包/类
/** accumulates per-segment multi-valued facet counts, mapping to global ordinal space on-the-fly */
static void accumMultiGeneric(int counts[], int startTermIndex, SortedSetDocValues si, DocIdSetIterator disi, int subIndex, OrdinalMap map) throws IOException {
final LongValues ordMap = map == null ? null : map.getGlobalOrds(subIndex);
int doc;
while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
si.setDocument(doc);
// strange do-while to collect the missing count (first ord is NO_MORE_ORDS)
int term = (int) si.nextOrd();
if (term < 0) {
if (startTermIndex == -1) {
counts[0]++; // missing count
}
continue;
}
do {
if (map != null) {
term = (int) ordMap.get(term);
}
int arrIdx = term-startTermIndex;
if (arrIdx>=0 && arrIdx<counts.length) counts[arrIdx]++;
} while ((term = (int) si.nextOrd()) >= 0);
}
}
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:25,代码来源:DocValuesFacets.java
示例3: getSortedNumeric
import org.apache.lucene.util.LongValues; //导入依赖的package包/类
@Override
public SortedNumericDocValues getSortedNumeric(FieldInfo field) throws IOException {
SortedSetEntry ss = sortedNumerics.get(field.number);
NumericEntry numericEntry = numerics.get(field.number);
final LongValues values = getNumeric(numericEntry);
if (ss.format == SORTED_SINGLE_VALUED) {
final Bits docsWithField = getMissingBits(numericEntry.missingOffset);
return DocValues.singleton(values, docsWithField);
} else if (ss.format == SORTED_WITH_ADDRESSES) {
final IndexInput data = this.data.clone();
final MonotonicBlockPackedReader ordIndex = getOrdIndexInstance(data, field, ordIndexes.get(field.number));
return new SortedNumericDocValues() {
long startOffset;
long endOffset;
@Override
public void setDocument(int doc) {
startOffset = ordIndex.get(doc);
endOffset = ordIndex.get(doc+1L);
}
@Override
public long valueAt(int index) {
return values.get(startOffset + index);
}
@Override
public int count() {
return (int) (endOffset - startOffset);
}
};
} else {
throw new AssertionError();
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:Lucene49DocValuesProducer.java
示例4: getSortedNumeric
import org.apache.lucene.util.LongValues; //导入依赖的package包/类
@Override
public SortedNumericDocValues getSortedNumeric(FieldInfo field) throws IOException {
SortedSetEntry ss = sortedNumerics.get(field.number);
NumericEntry numericEntry = numerics.get(field.number);
final LongValues values = getNumeric(numericEntry);
if (ss.format == SORTED_SINGLE_VALUED) {
final Bits docsWithField = getMissingBits(numericEntry.missingOffset);
return DocValues.singleton(values, docsWithField);
} else if (ss.format == SORTED_WITH_ADDRESSES) {
final MonotonicBlockPackedReader ordIndex = getOrdIndexInstance(field, ordIndexes.get(field.number));
return new SortedNumericDocValues() {
long startOffset;
long endOffset;
@Override
public void setDocument(int doc) {
startOffset = ordIndex.get(doc);
endOffset = ordIndex.get(doc+1L);
}
@Override
public long valueAt(int index) {
return values.get(startOffset + index);
}
@Override
public int count() {
return (int) (endOffset - startOffset);
}
};
} else {
throw new AssertionError();
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:Lucene410DocValuesProducer.java
示例5: accumSingleGeneric
import org.apache.lucene.util.LongValues; //导入依赖的package包/类
/** accumulates per-segment single-valued facet counts, mapping to global ordinal space on-the-fly */
static void accumSingleGeneric(int counts[], int startTermIndex, SortedDocValues si, DocIdSetIterator disi, int subIndex, OrdinalMap map) throws IOException {
final LongValues ordmap = map == null ? null : map.getGlobalOrds(subIndex);
int doc;
while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
int term = si.getOrd(doc);
if (map != null && term >= 0) {
term = (int) ordmap.get(term);
}
int arrIdx = term-startTermIndex;
if (arrIdx>=0 && arrIdx<counts.length) counts[arrIdx]++;
}
}
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:14,代码来源:DocValuesFacets.java
示例6: migrateGlobal
import org.apache.lucene.util.LongValues; //导入依赖的package包/类
/** folds counts in segment ordinal space (segCounts) into global ordinal space (counts) */
static void migrateGlobal(int counts[], int segCounts[], int subIndex, OrdinalMap map) {
final LongValues ordMap = map.getGlobalOrds(subIndex);
// missing count
counts[0] += segCounts[0];
// migrate actual ordinals
for (int ord = 1; ord < segCounts.length; ord++) {
int count = segCounts[ord];
if (count != 0) {
counts[1+(int) ordMap.get(ord-1)] += count;
}
}
}
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:15,代码来源:DocValuesFacets.java
示例7: accumulateObject
import org.apache.lucene.util.LongValues; //导入依赖的package包/类
public long accumulateObject(Object o, long shallowSize, java.util.Map<Field,Object> fieldValues, java.util.Collection<Object> queue) {
if (o == LongValues.IDENTITY) {
return 0L;
}
if (o instanceof OrdinalMap) {
fieldValues = new HashMap<>(fieldValues);
fieldValues.remove(ORDINAL_MAP_OWNER_FIELD);
}
return super.accumulateObject(o, shallowSize, fieldValues, queue);
}
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:TestOrdinalMap.java
示例8: getSorted
import org.apache.lucene.util.LongValues; //导入依赖的package包/类
@Override
public SortedDocValues getSorted(FieldInfo field) throws IOException {
final int valueCount = (int) binaries.get(field.number).count;
final BinaryDocValues binary = getBinary(field);
NumericEntry entry = ords.get(field.number);
final LongValues ordinals = getNumeric(entry);
return new SortedDocValues() {
@Override
public int getOrd(int docID) {
return (int) ordinals.get(docID);
}
@Override
public BytesRef lookupOrd(int ord) {
return binary.get(ord);
}
@Override
public int getValueCount() {
return valueCount;
}
@Override
public int lookupTerm(BytesRef key) {
if (binary instanceof CompressedBinaryDocValues) {
return (int) ((CompressedBinaryDocValues)binary).lookupTerm(key);
} else {
return super.lookupTerm(key);
}
}
@Override
public TermsEnum termsEnum() {
if (binary instanceof CompressedBinaryDocValues) {
return ((CompressedBinaryDocValues)binary).getTermsEnum();
} else {
return super.termsEnum();
}
}
};
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:44,代码来源:Lucene49DocValuesProducer.java
示例9: getSorted
import org.apache.lucene.util.LongValues; //导入依赖的package包/类
@Override
public SortedDocValues getSorted(FieldInfo field) throws IOException {
final int valueCount = (int) binaries.get(field.number).count;
final BinaryDocValues binary = getBinary(field);
NumericEntry entry = ords.get(field.number);
final LongValues ordinals = getNumeric(entry);
return new SortedDocValues() {
@Override
public int getOrd(int docID) {
return (int) ordinals.get(docID);
}
@Override
public BytesRef lookupOrd(int ord) {
return binary.get(ord);
}
@Override
public int getValueCount() {
return valueCount;
}
@Override
public int lookupTerm(BytesRef key) {
if (binary instanceof CompressedBinaryDocValues) {
return (int) ((CompressedBinaryDocValues)binary).lookupTerm(key);
} else {
return super.lookupTerm(key);
}
}
@Override
public TermsEnum termsEnum() {
if (binary instanceof CompressedBinaryDocValues) {
return ((CompressedBinaryDocValues)binary).getTermsEnum();
} else {
return super.termsEnum();
}
}
};
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:Lucene410DocValuesProducer.java
示例10: getGlobalOrds
import org.apache.lucene.util.LongValues; //导入依赖的package包/类
/**
* Given a segment number, return a {@link LongValues} instance that maps
* segment ordinals to global ordinals.
*/
public LongValues getGlobalOrds(int segmentIndex) {
return segmentToGlobalOrds[segmentMap.oldToNew(segmentIndex)];
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:MultiDocValues.java
注:本文中的org.apache.lucene.util.LongValues类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论