本文整理汇总了Java中org.apache.lucene.index.SortedSetDocValues.nextOrd方法的典型用法代码示例。如果您正苦于以下问题:Java SortedSetDocValues.nextOrd方法的具体用法?Java SortedSetDocValues.nextOrd怎么用?Java SortedSetDocValues.nextOrd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.index.SortedSetDocValues
的用法示例。
在下文中一共展示了SortedSetDocValues.nextOrd方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accumMultiGeneric
import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的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);
}
}
示例2: accumMulti
import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
/** accumulates per-segment multi-valued facet counts, mapping to global ordinal space */
static void accumMulti(int counts[], int startTermIndex, SortedSetDocValues si, DocIdSetIterator disi, int subIndex, OrdinalMap map) throws IOException {
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) map.getGlobalOrd(subIndex, term);
}
int arrIdx = term-startTermIndex;
if (arrIdx>=0 && arrIdx<counts.length) counts[arrIdx]++;
} while ((term = (int) si.nextOrd()) >= 0);
}
}
示例3: accumMultiGeneric
import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的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 {
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) map.getGlobalOrd(subIndex, term);
}
int arrIdx = term-startTermIndex;
if (arrIdx>=0 && arrIdx<counts.length) counts[arrIdx]++;
} while ((term = (int) si.nextOrd()) >= 0);
}
}
示例4: accumMultiSeg
import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
/** "typical" multi-valued faceting: not too many unique values, no prefixing. maps to global ordinals as a separate step */
static void accumMultiSeg(int counts[], SortedSetDocValues si, DocIdSetIterator disi, int subIndex, OrdinalMap map) throws IOException {
// First count in seg-ord space:
final int segCounts[];
if (map == null) {
segCounts = counts;
} else {
segCounts = new int[1+(int)si.getValueCount()];
}
int doc;
while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
si.setDocument(doc);
int term = (int) si.nextOrd();
if (term < 0) {
counts[0]++; // missing
} else {
do {
segCounts[1+term]++;
} while ((term = (int)si.nextOrd()) >= 0);
}
}
// migrate to global ords (if necessary)
if (map != null) {
migrateGlobal(counts, segCounts, subIndex, map);
}
}
示例5: write
import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
public void write(int docId, AtomicReader reader, Writer out) throws IOException {
SortedSetDocValues vals = reader.getSortedSetDocValues(this.field);
vals.setDocument(docId);
out.write('"');
out.write(this.field);
out.write('"');
out.write(':');
out.write('[');
int v = 0;
long ord = -1;
while((ord = vals.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
BytesRef ref = vals.lookupOrd(ord);
fieldType.indexedToReadable(ref, cref);
if(v > 0) {
out.write(',');
}
if(!numeric) {
out.write('"');
}
out.write(cref.toString());
if(!numeric) {
out.write('"');
}
++v;
}
out.write("]");
}
示例6: accumIntervalsMulti
import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
private void accumIntervalsMulti(SortedSetDocValues ssdv,
DocIdSetIterator disi, Bits bits) throws IOException {
// First update the ordinals in the intervals for this segment
for (FacetInterval interval : intervals) {
interval.updateContext(ssdv);
}
int doc;
while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
if (bits != null && bits.get(doc) == false) {
continue;
}
ssdv.setDocument(doc);
long currOrd;
int currentInterval = 0;
while ((currOrd = ssdv.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
boolean evaluateNextInterval = true;
while (evaluateNextInterval && currentInterval < intervals.length) {
IntervalCompareResult result = intervals[currentInterval].includes(currOrd);
switch (result) {
case INCLUDED:
/*
* Increment the current interval and move to the next one using
* the same value
*/
intervals[currentInterval].incCount();
currentInterval++;
break;
case LOWER_THAN_START:
/*
* None of the next intervals will match this value (all of them have
* higher start value). Move to the next value for this document.
*/
evaluateNextInterval = false;
break;
case GREATER_THAN_END:
/*
* Next interval may match this value
*/
currentInterval++;
break;
}
}
}
}
}
示例7: getSortedSetDocValues
import org.apache.lucene.index.SortedSetDocValues; //导入方法依赖的package包/类
@Override
public SortedSetDocValues getSortedSetDocValues(String field) throws IOException {
final SortedSetDocValues sortedSetDocValues = in.getSortedSetDocValues(field);
if (sortedSetDocValues == null) {
return null;
}
return new SortedSetDocValues() {
private boolean _access;
@Override
public void setDocument(int docID) {
try {
if (_access = _accessControl.hasAccess(ReadType.SORTED_SET_DOC_VALUE, docID)) {
sortedSetDocValues.setDocument(docID);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public long nextOrd() {
if (_access) {
return sortedSetDocValues.nextOrd();
}
return NO_MORE_ORDS;
}
@Override
public void lookupOrd(long ord, BytesRef result) {
if (_access) {
sortedSetDocValues.lookupOrd(ord, result);
} else {
result.bytes = BinaryDocValues.MISSING;
result.length = 0;
result.offset = 0;
}
}
@Override
public long getValueCount() {
return sortedSetDocValues.getValueCount();
}
};
}