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

x33g5p2x  于2022-02-01 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(168)

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

Util.get介绍

[英]Looks up the output for this input, or null if the input is not accepted
[中]查找此输入的输出,如果输入不被接受,则为null

代码示例

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

throw new RuntimeException("seek state is broken");
BytesRef output = Util.get(fr.index, prefix);
if (output == null) {
 out.println("      broken seek state: prefix is not final in index");

代码示例来源:origin: lintool/warcbase

public int getID(String url) {
 Long id = null;
 try {
  id = Util.get(fst, new BytesRef(url));
 } catch (IOException e) {
  // Log error, but assume that URL doesn't exist.
  LOG.error("Error fetching " + url);
  e.printStackTrace();
  return -1;
 }
 return id == null ? -1 : id.intValue();
}

代码示例来源:origin: lintool/warcbase

public int[] getIdRange(String first, String last){
 if (first == null || last == null) {
  return null;
 }
 Long startId = null, endId = null;
 try {
  startId = Util.get(fst, new BytesRef(first));
  endId = Util.get(fst, new BytesRef(last));
  if (startId == null || endId == null) {
   return null;
  }
 } catch (IOException e) {
  LOG.error("Error: " + e);
  e.printStackTrace();
  return null;
 }
 return new int[] { (int) startId.longValue(), (int) endId.longValue() };
}

代码示例来源:origin: NationalSecurityAgency/datawave

final IntsRef ints = irBuilder.get();
synchronized (this.fst) {
  if (Util.get(this.fst, ints) != null) {
    matches = true;

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

@Override
public ClassificationResult<Boolean> assignClass(String text)
    throws IOException {
 Long output = 0L;
 try (TokenStream tokenStream = analyzer.tokenStream(textFieldName, text)) {
  CharTermAttribute charTermAttribute = tokenStream
      .addAttribute(CharTermAttribute.class);
  tokenStream.reset();
  while (tokenStream.incrementToken()) {
   String s = charTermAttribute.toString();
   Long d = Util.get(fst, new BytesRef(s));
   if (d != null) {
    output += d;
   }
  }
  tokenStream.end();
 }
 double score = 1 - Math.exp(-1 * Math.abs(bias - output.doubleValue()) / bias);
 return new ClassificationResult<>(output >= bias, score);
}

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

throw new RuntimeException("seek state is broken");
BytesRef output = Util.get(fr.index, prefix);
if (output == null) {
 out.println("      broken seek state: prefix is not final in index");

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

throw new RuntimeException("seek state is broken");
BytesRef output = Util.get(fr.index, prefix);
if (output == null) {
 out.println("      broken seek state: prefix is not final in index");

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

throw new RuntimeException("seek state is broken");
BytesRef output = Util.get(fr.index, prefix);
if (output == null) {
 out.println("      broken seek state: prefix is not final in index");

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

throw new RuntimeException("seek state is broken");
BytesRef output = Util.get(fr.index, prefix);
if (output == null) {
 out.println("      broken seek state: prefix is not final in index");

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

throw new RuntimeException("seek state is broken");
Output output = Util.get(fr.index, prefix);
if (output == null) {
 out.println("      broken seek state: prefix is not final in index");

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

throw new RuntimeException("seek state is broken");
Pair<BytesRef,Long> output = Util.get(fr.index, prefix);
if (output == null) {
 out.println("      broken seek state: prefix is not final in index");

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

throw new RuntimeException("seek state is broken");
Pair<BytesRef,Long> output = Util.get(fr.index, prefix);
if (output == null) {
 out.println("      broken seek state: prefix is not final in index");

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

private void updateWeights(IndexReader indexReader,
              int docId, Boolean assignedClass, SortedMap<String, Double> weights,
              double modifier, boolean updateFST) throws IOException {
 TermsEnum cte = textTerms.iterator();
 // get the doc term vectors
 Terms terms = indexReader.getTermVector(docId, textFieldName);
 if (terms == null) {
  throw new IOException("term vectors must be stored for field "
      + textFieldName);
 }
 TermsEnum termsEnum = terms.iterator();
 BytesRef term;
 while ((term = termsEnum.next()) != null) {
  cte.seekExact(term);
  if (assignedClass != null) {
   long termFreqLocal = termsEnum.totalTermFreq();
   // update weights
   Long previousValue = Util.get(fst, term);
   String termString = term.utf8ToString();
   weights.put(termString, previousValue == null ? 0 : Math.max(0, previousValue + modifier * termFreqLocal));
  }
 }
 if (updateFST) {
  updateFST(weights);
 }
}

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

if (token.byteAt(i) == separator) {
 BytesRef context = new BytesRef(token.bytes(), 0, i);
 Long output = Util.get(fst, Util.toIntsRef(context, new IntsRefBuilder()));
 assert output != null;
 contextCount = decodeWeight(output);

相关文章