当前位置: 首页>>代码示例>>Java>>正文


Java SortedSetDocValues.nextOrd方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:25,代码来源:DocValuesFacets.java

示例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);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:24,代码来源:DocValuesFacets.java

示例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);
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:24,代码来源:DocValuesFacets.java

示例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);
  }
}
 
开发者ID:upenn-libraries,项目名称:solrplugins,代码行数:29,代码来源:DocValuesFacets.java

示例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("]");
}
 
开发者ID:europeana,项目名称:search,代码行数:31,代码来源:SortingResponseWriter.java

示例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;
        }
      }
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:47,代码来源:IntervalFacets.java

示例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();
    }
  };
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:47,代码来源:SecureAtomicReader.java


注:本文中的org.apache.lucene.index.SortedSetDocValues.nextOrd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。