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

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

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

BytesRefHash.addByPoolOffset介绍

[英]Adds a "arbitrary" int offset instead of a BytesRef term. This is used in the indexer to hold the hash for term vectors, because they do not redundantly store the byte[] term directly and instead reference the byte[] term already stored by the postings BytesRefHash. See add(int textStart) in TermsHashPerField.
[中]添加“任意”整数偏移量,而不是BytesRef项。这在索引器中用于保存术语向量的散列,因为它们不直接冗余存储byte[]术语,而是引用postings BytesRefHash已经存储的byte[]术语。请参阅TermsHashPerField中的add(int textStart)。

代码示例

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

public void add(int textStart) throws IOException {
 int termID = bytesHash.addByPoolOffset(textStart);
 if (termID >= 0) {      // New posting
  // First time we are seeing this token since we last
  // flushed the hash.
  // Init stream slices
  if (numPostingInt + intPool.intUpto > IntBlockPool.INT_BLOCK_SIZE) {
   intPool.nextBuffer();
  }
  if (ByteBlockPool.BYTE_BLOCK_SIZE - bytePool.byteUpto < numPostingInt*ByteBlockPool.FIRST_LEVEL_SIZE) {
   bytePool.nextBuffer();
  }
  intUptos = intPool.buffer;
  intUptoStart = intPool.intUpto;
  intPool.intUpto += streamCount;
  postingsArray.intStarts[termID] = intUptoStart + intPool.intOffset;
  for(int i=0;i<streamCount;i++) {
   final int upto = bytePool.newSlice(ByteBlockPool.FIRST_LEVEL_SIZE);
   intUptos[intUptoStart+i] = upto + bytePool.byteOffset;
  }
  postingsArray.byteStarts[termID] = intUptos[intUptoStart];
  newTerm(termID);
 } else {
  termID = (-termID)-1;
  int intStart = postingsArray.intStarts[termID];
  intUptos = intPool.buffers[intStart >> IntBlockPool.INT_BLOCK_SHIFT];
  intUptoStart = intStart & IntBlockPool.INT_BLOCK_MASK;
  addTerm(termID);
 }
}

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

public void add(int textStart) throws IOException {
 int termID = bytesHash.addByPoolOffset(textStart);
 if (termID >= 0) {      // New posting
  // First time we are seeing this token since we last
  // flushed the hash.
  // Init stream slices
  if (numPostingInt + intPool.intUpto > IntBlockPool.INT_BLOCK_SIZE) {
   intPool.nextBuffer();
  }
  if (ByteBlockPool.BYTE_BLOCK_SIZE - bytePool.byteUpto < numPostingInt*ByteBlockPool.FIRST_LEVEL_SIZE) {
   bytePool.nextBuffer();
  }
  intUptos = intPool.buffer;
  intUptoStart = intPool.intUpto;
  intPool.intUpto += streamCount;
  postingsArray.intStarts[termID] = intUptoStart + intPool.intOffset;
  for(int i=0;i<streamCount;i++) {
   final int upto = bytePool.newSlice(ByteBlockPool.FIRST_LEVEL_SIZE);
   intUptos[intUptoStart+i] = upto + bytePool.byteOffset;
  }
  postingsArray.byteStarts[termID] = intUptos[intUptoStart];
  newTerm(termID);
 } else {
  termID = (-termID)-1;
  int intStart = postingsArray.intStarts[termID];
  intUptos = intPool.buffers[intStart >> IntBlockPool.INT_BLOCK_SHIFT];
  intUptoStart = intStart & IntBlockPool.INT_BLOCK_MASK;
  addTerm(termID);
 }
}

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

public void add(int textStart) throws IOException {
 int termID = bytesHash.addByPoolOffset(textStart);
 if (termID >= 0) {      // New posting
  // First time we are seeing this token since we last
  // flushed the hash.
  // Init stream slices
  if (numPostingInt + intPool.intUpto > IntBlockPool.INT_BLOCK_SIZE) {
   intPool.nextBuffer();
  }
  if (ByteBlockPool.BYTE_BLOCK_SIZE - bytePool.byteUpto < numPostingInt*ByteBlockPool.FIRST_LEVEL_SIZE) {
   bytePool.nextBuffer();
  }
  intUptos = intPool.buffer;
  intUptoStart = intPool.intUpto;
  intPool.intUpto += streamCount;
  postingsArray.intStarts[termID] = intUptoStart + intPool.intOffset;
  for(int i=0;i<streamCount;i++) {
   final int upto = bytePool.newSlice(ByteBlockPool.FIRST_LEVEL_SIZE);
   intUptos[intUptoStart+i] = upto + bytePool.byteOffset;
  }
  postingsArray.byteStarts[termID] = intUptos[intUptoStart];
  newTerm(termID);
 } else {
  termID = (-termID)-1;
  int intStart = postingsArray.intStarts[termID];
  intUptos = intPool.buffers[intStart >> IntBlockPool.INT_BLOCK_SHIFT];
  intUptoStart = intStart & IntBlockPool.INT_BLOCK_MASK;
  addTerm(termID);
 }
}

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

public void add(int textStart) throws IOException {
 int termID = bytesHash.addByPoolOffset(textStart);
 if (termID >= 0) {      // New posting
  // First time we are seeing this token since we last
  // flushed the hash.
  // Init stream slices
  if (numPostingInt + intPool.intUpto > IntBlockPool.INT_BLOCK_SIZE) {
   intPool.nextBuffer();
  }
  if (ByteBlockPool.BYTE_BLOCK_SIZE - bytePool.byteUpto < numPostingInt*ByteBlockPool.FIRST_LEVEL_SIZE) {
   bytePool.nextBuffer();
  }
  intUptos = intPool.buffer;
  intUptoStart = intPool.intUpto;
  intPool.intUpto += streamCount;
  postingsArray.intStarts[termID] = intUptoStart + intPool.intOffset;
  for(int i=0;i<streamCount;i++) {
   final int upto = bytePool.newSlice(ByteBlockPool.FIRST_LEVEL_SIZE);
   intUptos[intUptoStart+i] = upto + bytePool.byteOffset;
  }
  postingsArray.byteStarts[termID] = intUptos[intUptoStart];
  newTerm(termID);
 } else {
  termID = (-termID)-1;
  int intStart = postingsArray.intStarts[termID];
  intUptos = intPool.buffers[intStart >> IntBlockPool.INT_BLOCK_SHIFT];
  intUptoStart = intStart & IntBlockPool.INT_BLOCK_MASK;
  addTerm(termID);
 }
}

相关文章