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

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

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

BytesRefHash.get介绍

[英]Populates and returns a BytesRef with the bytes for the given bytesID.

Note: the given bytesID must be a positive integer less than the current size ( #size())
[中]使用给定bytesID的字节填充并返回BytesRef。
注意:给定的bytesID必须是小于当前大小(#size())的正整数

代码示例

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

@Override
public BytesRef lookupOrd(int ord) {
 assert ord >= 0 && ord < sortedValues.length;
 assert sortedValues[ord] >= 0 && sortedValues[ord] < sortedValues.length;
 hash.get(sortedValues[ord], scratch);
 return scratch;
}

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

@Override
 public BytesRef lookupOrd(long ord) {
  assert ord >= 0 && ord < ordMap.length: "ord=" + ord + " is out of bounds 0 .. " + (ordMap.length-1);
  hash.get(sortedValues[Math.toIntExact(ord)], scratch);
  return scratch;
 }
}

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

@Override
public final Query rewrite(final IndexReader reader, final MultiTermQuery query) throws IOException {
 final B builder = getTopLevelBuilder();
 final ParallelArraysTermCollector col = new ParallelArraysTermCollector();
 collectTerms(reader, query, col);
 
 final int size = col.terms.size();
 if (size > 0) {
  final int sort[] = col.terms.sort();
  final float[] boost = col.array.boost;
  final TermContext[] termStates = col.array.termState;
  for (int i = 0; i < size; i++) {
   final int pos = sort[i];
   final Term term = new Term(query.getField(), col.terms.get(pos, new BytesRef()));
   assert reader.docFreq(term) == termStates[pos].docFreq();
   addClause(builder, term, termStates[pos].docFreq(), boost[pos], termStates[pos]);
  }
 }
 return build(builder);
}

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

boolean checkOnlyInCompound = dictionary.onlyincompound != -1;
if (checkKeepCase || checkNeedAffix || checkOnlyInCompound) {
 dictionary.flagLookup.get(forms.ints[forms.offset+i], scratch);
 char wordFlags[] = Dictionary.decodeFlags(scratch);

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

for(int outputIDX=0;outputIDX<count;outputIDX++) {
 int wordID = bytesReader.readVInt();
 synonyms.words.get(wordID, scratchBytes);
 scratchChars.copyUTF8Bytes(scratchBytes);
 int lastStart = 0;

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

if (forms != null) {
 for (int i = 0; i < forms.length; i += formStep) {
  dictionary.flagLookup.get(forms.ints[forms.offset+i], scratch);
  char wordFlags[] = Dictionary.decodeFlags(scratch);
  if (Dictionary.hasFlag(wordFlags, flag)) {
   if (chainedPrefix == false && prefixFlag >= 0 && !Dictionary.hasFlag(wordFlags, (char)prefixFlag)) {
    dictionary.flagLookup.get(append, scratch);
    char appendFlags[] = Dictionary.decodeFlags(scratch);
    if (!hasCrossCheckedFlag((char)prefixFlag, appendFlags, false)) {
    dictionary.flagLookup.get(append, scratch);
    char appendFlags[] = Dictionary.decodeFlags(scratch);
    boolean suffixCircumfix = Dictionary.hasFlag(appendFlags, (char)dictionary.circumfix);
 dictionary.flagLookup.get(append, scratch);
 char appendFlags[] = Dictionary.decodeFlags(scratch);
 circumfix = Dictionary.hasFlag(appendFlags, (char)dictionary.circumfix);

代码示例来源:origin: flaxsearch/luwak

@Override
  public BytesRef next() throws IOException {
    if (upto >= sortedTerms.length)
      return null;
    upto++;
    if (sortedTerms[upto] == -1)
      return null;
    this.terms.get(sortedTerms[upto], scratch);
    return scratch;
  }
}

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

@Override
public BytesRef lookupOrd(int ord) {
 assert ord >= 0 && ord < sortedValues.length;
 assert sortedValues[ord] >= 0 && sortedValues[ord] < sortedValues.length;
 hash.get(sortedValues[ord], scratch);
 return scratch;
}

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

@Override
public BytesRef currentValue() {
 if (groupId == -1)
  return null;
 values.get(groupId, scratch);
 return scratch;
}

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

/**
 * Returns an {@link StemmerOverrideMap} to be used with the {@link StemmerOverrideFilter}
 * @return an {@link StemmerOverrideMap} to be used with the {@link StemmerOverrideFilter}
 * @throws IOException if an {@link IOException} occurs;
 */
public StemmerOverrideMap build() throws IOException {
 ByteSequenceOutputs outputs = ByteSequenceOutputs.getSingleton();
 org.apache.lucene.util.fst.Builder<BytesRef> builder = new org.apache.lucene.util.fst.Builder<>(
   FST.INPUT_TYPE.BYTE4, outputs);
 final int[] sort = hash.sort();
 IntsRefBuilder intsSpare = new IntsRefBuilder();
 final int size = hash.size();
 BytesRef spare = new BytesRef();
 for (int i = 0; i < size; i++) {
  int id = sort[i];
  BytesRef bytesRef = hash.get(id, spare);
  intsSpare.copyUTF8Bytes(bytesRef);
  builder.add(intsSpare.get(), new BytesRef(outputValues.get(id)));
 }
 return new StemmerOverrideMap(builder.finish(), ignoreCase);
}

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

} else {
 dictionary.flagLookup.get(append, scratch);
 char appendFlags[] = Dictionary.decodeFlags(scratch);
 compatible = !Dictionary.hasFlag(appendFlags, (char) dictionary.onlyincompound);
dictionary.flagLookup.get(append, scratch);
char appendFlags[] = Dictionary.decodeFlags(scratch);
assert prevFlag >= 0;
} else {
 dictionary.flagLookup.get(append, scratch);
 char appendFlags[] = Dictionary.decodeFlags(scratch);
 compatible = !Dictionary.hasFlag(appendFlags, (char) dictionary.onlyincompound);
dictionary.flagLookup.get(append, scratch);
char appendFlags[] = Dictionary.decodeFlags(scratch);
assert prevFlag >= 0;

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

@Override
 public BytesRef lookupOrd(long ord) {
  assert ord >= 0 && ord < ordMap.length: "ord=" + ord + " is out of bounds 0 .. " + (ordMap.length-1);
  hash.get(sortedValues[Math.toIntExact(ord)], scratch);
  return scratch;
 }
}

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

synonyms.words.get(bytesReader.readVInt(),
          scratchBytes);

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

@Override
public BytesRef next() {
 termUpto++;
 if (termUpto >= info.terms.size()) {
  return null;
 } else {
  info.terms.get(info.sortedTerms[termUpto], br);
  return br;
 }
}

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

@Override
public BytesRef next() {
 if (!hasNext()) {
  throw new NoSuchElementException();
 }
 hash.get(sortedValues[ordUpto], scratch);
 ordUpto++;
 return scratch;
}

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

@Override
public void seekExact(long ord) {
 assert ord < info.terms.size();
 termUpto = (int) ord;
 info.terms.get(info.sortedTerms[termUpto], br);
}

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

@Override
public BytesRef next() {
 if (!hasNext()) {
  throw new NoSuchElementException();
 }
 hash.get(sortedValues[ordUpto], scratch);
 ordUpto++;
 return scratch;
}

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

private SortedDocValues getSortedDocValues(String field, DocValuesType docValuesType) {
 Info info = getInfoForExpectedDocValuesType(field, docValuesType);
 if (info != null) {
  BytesRef value = info.binaryProducer.dvBytesValuesSet.get(0, new BytesRef());
  return sortedDocValues(value);
 } else {
  return null;
 }
}

代码示例来源:origin: sirensolutions/siren-join

SeekingTermSetTermsEnum(TermsEnum tenum, BytesRefTermsSet termsSet) {
 super(tenum);
 this.terms = termsSet.getBytesRefHash();
 this.ords = this.terms.sort(BytesRef.getUTF8SortedAsUnicodeComparator());
 lastElement = terms.size() - 1;
 lastTerm = terms.get(ords[lastElement], new BytesRef());
 seekTerm = terms.get(ords[upto], spare);
}

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

@Override
public void setNextReader(LeafReaderContext readerContext) throws IOException {
 this.docValues = DocValues.getSorted(readerContext.reader(), field);
 this.ordsToGroupIds.clear();
 BytesRef scratch = new BytesRef();
 for (int i = 0; i < values.size(); i++) {
  values.get(i, scratch);
  int ord = this.docValues.lookupTerm(scratch);
  if (ord >= 0)
   ordsToGroupIds.put(ord, i);
 }
}

相关文章