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


Java Util.toBytesRef方法代码示例

本文整理汇总了Java中org.apache.lucene.util.fst.Util.toBytesRef方法的典型用法代码示例。如果您正苦于以下问题:Java Util.toBytesRef方法的具体用法?Java Util.toBytesRef怎么用?Java Util.toBytesRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.util.fst.Util的用法示例。


在下文中一共展示了Util.toBytesRef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: seekExact

import org.apache.lucene.util.fst.Util; //导入方法依赖的package包/类
@Override
public void seekExact(long ord) throws IOException {
  // TODO: would be better to make this simpler and faster.
  // but we dont want to introduce a bug that corrupts our enum state!
  bytesReader.setPosition(0);
  fst.getFirstArc(firstArc);
  IntsRef output = Util.getByOutput(fst, ord, bytesReader, firstArc, scratchArc, scratchInts);
  BytesRefBuilder scratchBytes = new BytesRefBuilder();
  scratchBytes.clear();
  Util.toBytesRef(output, scratchBytes);
  // TODO: we could do this lazily, better to try to push into FSTEnum though?
  in.seekExact(scratchBytes.get());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:Lucene42DocValuesProducer.java

示例2: incrementToken

import org.apache.lucene.util.fst.Util; //导入方法依赖的package包/类
@Override
public boolean incrementToken() throws IOException {
    clearAttributes();
    if (finiteStrings == null) {
        Set<IntsRef> strings = toFiniteStrings.toFiniteStrings(input);

        if (strings.size() > MAX_PATHS) {
            throw new IllegalArgumentException("TokenStream expanded to " + strings.size() + " finite strings. Only <= " + MAX_PATHS
                    + " finite strings are supported");
        }
        posInc = strings.size();
        finiteStrings = strings.iterator();
    }
    if (finiteStrings.hasNext()) {
        posAttr.setPositionIncrement(posInc);
        /*
         * this posInc encodes the number of paths that this surface form
         * produced. Multi Fields have the same surface form and therefore sum up
         */
        posInc = 0;
        Util.toBytesRef(finiteStrings.next(), bytesAtt.builder()); // now we have UTF-8
        if (charTermAttribute != null) {
            charTermAttribute.setLength(0);
            charTermAttribute.append(bytesAtt.toUTF16());
        }
        if (payload != null) {
            payloadAttr.setPayload(this.payload);
        }
        return true;
    }

    return false;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:34,代码来源:CompletionTokenStream.java

示例3: seekExact

import org.apache.lucene.util.fst.Util; //导入方法依赖的package包/类
@Override
public void seekExact(long ord) throws IOException {
  // TODO: would be better to make this simpler and faster.
  // but we dont want to introduce a bug that corrupts our enum state!
  bytesReader.setPosition(0);
  fst.getFirstArc(firstArc);
  IntsRef output = Util.getByOutput(fst, ord, bytesReader, firstArc, scratchArc, scratchInts);
  scratchBytes.bytes = new byte[output.length];
  scratchBytes.offset = 0;
  scratchBytes.length = 0;
  Util.toBytesRef(output, scratchBytes);
  // TODO: we could do this lazily, better to try to push into FSTEnum though?
  in.seekExact(scratchBytes);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:15,代码来源:Lucene42DocValuesProducer.java


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