org.apache.lucene.util.BytesRefHash.compact()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.apache.lucene.util.BytesRefHash.compact()方法的一些代码示例,展示了BytesRefHash.compact()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BytesRefHash.compact()方法的具体详情如下:
包路径:org.apache.lucene.util.BytesRefHash
类名称:BytesRefHash
方法名:compact

BytesRefHash.compact介绍

[英]Returns the ids array in arbitrary order. Valid ids start at offset of 0 and end at a limit of #size() - 1

Note: This is a destructive operation. #clear() must be called in order to reuse this BytesRefHash instance.
[中]按任意顺序返回ids数组。有效ID开始于偏移量0,结束于限制#size()-1
注意:这是一种破坏性操作#必须调用clear()才能重用此ByteRefHash实例。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

/**
 * Returns the values array sorted by the referenced byte values.
 * <p>
 * Note: This is a destructive operation. {@link #clear()} must be called in
 * order to reuse this {@link BytesRefHash} instance.
 * </p>
 */
public int[] sort() {
 final int[] compact = compact();
 new StringMSBRadixSorter() {
  BytesRef scratch = new BytesRef();
  @Override
  protected void swap(int i, int j) {
   int tmp = compact[i];
   compact[i] = compact[j];
   compact[j] = tmp;
  }
  @Override
  protected BytesRef get(int i) {
   pool.setBytesRef(scratch, bytesStart[compact[i]]);
   return scratch;
  }
 }.sort(0, count);
 return compact;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Returns the values array sorted by the referenced byte values.
 * <p>
 * Note: This is a destructive operation. {@link #clear()} must be called in
 * order to reuse this {@link BytesRefHash} instance.
 * </p>
 */
public int[] sort() {
 final int[] compact = compact();
 new StringMSBRadixSorter() {
  BytesRef scratch = new BytesRef();
  @Override
  protected void swap(int i, int j) {
   int tmp = compact[i];
   compact[i] = compact[j];
   compact[j] = tmp;
  }
  @Override
  protected BytesRef get(int i) {
   pool.setBytesRef(scratch, bytesStart[compact[i]]);
   return scratch;
  }
 }.sort(0, count);
 return compact;
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

final int[] compact = compact();
new IntroSorter() {
 @Override

代码示例来源:origin: harbby/presto-connectors

final int[] compact = compact();
new IntroSorter() {
 @Override

相关文章