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


Java PositiveIntOutputs类代码示例

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


PositiveIntOutputs类属于org.apache.lucene.util.fst包,在下文中一共展示了PositiveIntOutputs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeFST

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private void writeFST(FieldInfo field, Iterable<BytesRef> values) throws IOException {
  meta.writeVInt(field.number);
  meta.writeByte(FST);
  meta.writeLong(data.getFilePointer());
  PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
  Builder<Long> builder = new Builder<>(INPUT_TYPE.BYTE1, outputs);
  IntsRefBuilder scratch = new IntsRefBuilder();
  long ord = 0;
  for (BytesRef v : values) {
    builder.add(Util.toIntsRef(v, scratch), ord);
    ord++;
  }
  FST<Long> fst = builder.finish();
  if (fst != null) {
    fst.save(data);
  }
  meta.writeVLong(ord);
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:MemoryDocValuesConsumer.java

示例2: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(DataInput input) throws IOException {
  CodecUtil.checkHeader(input, CODEC_NAME, VERSION_START, VERSION_START);
  count = input.readVLong();
  byte separatorOrig = input.readByte();
  if (separatorOrig != separator) {
    throw new IllegalStateException("separator=" + separator + " is incorrect: original model was built with separator=" + separatorOrig);
  }
  int gramsOrig = input.readVInt();
  if (gramsOrig != grams) {
    throw new IllegalStateException("grams=" + grams + " is incorrect: original model was built with grams=" + gramsOrig);
  }
  totTokens = input.readVLong();

  fst = new FST<>(input, PositiveIntOutputs.getSingleton());

  return true;
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:FreeTextSuggester.java

示例3: TokenInfoDictionary

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private TokenInfoDictionary() throws IOException {
  super();
  InputStream is = null;
  FST<Long> fst = null;
  boolean success = false;
  try {
    is = getResource(FST_FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    fst = new FST<>(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton());
    success = true;
  } finally {
    if (success) {
      IOUtils.close(is);
    } else {
      IOUtils.closeWhileHandlingException(is);
    }
  }
  // TODO: some way to configure?
  this.fst = new TokenInfoFST(fst, true);
}
 
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:TokenInfoDictionary.java

示例4: build

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public void build(TermFreqIterator iterator) throws IOException {
  BytesRef scratch = new BytesRef();
  TermFreqIterator iter = new WFSTTermFreqIteratorWrapper(iterator);
  IntsRef scratchInts = new IntsRef();
  BytesRef previous = null;
  PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
  Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, outputs);
  while ((scratch = iter.next()) != null) {
    long cost = iter.weight();
    
    if (previous == null) {
      previous = new BytesRef();
    } else if (scratch.equals(previous)) {
      continue; // for duplicate suggestions, the best weight is actually
                // added
    }
    Util.toIntsRef(scratch, scratchInts);
    builder.add(scratchInts, cost);
    previous.copyBytes(scratch);
  }
  fst = builder.finish();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:24,代码来源:WFSTCompletionLookup.java

示例5: TokenInfoDictionary

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private TokenInfoDictionary() throws IOException {
  super();
  IOException priorE = null;
  InputStream is = null;
  FST<Long> fst = null;
  try {
    is = getResource(FST_FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    fst = new FST<Long>(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton(true));
  } catch (IOException ioe) {
    priorE = ioe;
  } finally {
    IOUtils.closeWhileHandlingException(priorE, is);
  }
  // TODO: some way to configure?
  this.fst = new TokenInfoFST(fst, true);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:18,代码来源:TokenInfoDictionary.java

示例6: writeFST

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private void writeFST(FieldInfo field, Iterable<BytesRef> values) throws IOException {
  meta.writeVInt(field.number);
  meta.writeByte(FST);
  meta.writeLong(data.getFilePointer());
  PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
  Builder<Long> builder = new Builder<Long>(INPUT_TYPE.BYTE1, outputs);
  IntsRef scratch = new IntsRef();
  long ord = 0;
  for (BytesRef v : values) {
    builder.add(Util.toIntsRef(v, scratch), ord);
    ord++;
  }
  FST<Long> fst = builder.finish();
  if (fst != null) {
    fst.save(data);
  }
  meta.writeVLong(ord);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:19,代码来源:Lucene42DocValuesConsumer.java

示例7: writeFST

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private void writeFST(FieldInfo field, Iterable<BytesRef> values) throws IOException {
  meta.writeVInt(field.number);
  meta.writeByte(FST);
  meta.writeLong(data.getFilePointer());
  PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
  Builder<Long> builder = new Builder<Long>(INPUT_TYPE.BYTE1, outputs);
  IntsRef scratch = new IntsRef();
  long ord = 0;
  for (BytesRef v : values) {
    builder.add(Util.toIntsRef(v, scratch), ord);
    ord++;
  }
  FST<Long> fst = builder.finish();
  if (fst != null) {
    fst.save(data);
  }
  meta.writeVLong(ord);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:MemoryDocValuesConsumer.java

示例8: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(DataInput input) throws IOException {
  CodecUtil.checkHeader(input, CODEC_NAME, VERSION_START, VERSION_START);
  count = input.readVLong();
  byte separatorOrig = input.readByte();
  if (separatorOrig != separator) {
    throw new IllegalStateException("separator=" + separator + " is incorrect: original model was built with separator=" + separatorOrig);
  }
  int gramsOrig = input.readVInt();
  if (gramsOrig != grams) {
    throw new IllegalStateException("grams=" + grams + " is incorrect: original model was built with grams=" + gramsOrig);
  }
  totTokens = input.readVLong();

  fst = new FST<Long>(input, PositiveIntOutputs.getSingleton());

  return true;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:FreeTextSuggester.java

示例9: TokenInfoDictionary

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private TokenInfoDictionary() throws IOException {
  super();
  IOException priorE = null;
  InputStream is = null;
  FST<Long> fst = null;
  try {
    is = getResource(FST_FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    fst = new FST<Long>(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton());
  } catch (IOException ioe) {
    priorE = ioe;
  } finally {
    IOUtils.closeWhileHandlingException(priorE, is);
  }
  // TODO: some way to configure?
  this.fst = new TokenInfoFST(fst, true);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:18,代码来源:TokenInfoDictionary.java

示例10: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(InputStream input) throws IOException {
  DataInput in = new InputStreamDataInput(input);
  CodecUtil.checkHeader(in, CODEC_NAME, VERSION_START, VERSION_START);
  byte separatorOrig = in.readByte();
  if (separatorOrig != separator) {
    throw new IllegalStateException("separator=" + separator + " is incorrect: original model was built with separator=" + separatorOrig);
  }
  int gramsOrig = in.readVInt();
  if (gramsOrig != grams) {
    throw new IllegalStateException("grams=" + grams + " is incorrect: original model was built with grams=" + gramsOrig);
  }
  totTokens = in.readVLong();

  fst = new FST<Long>(in, PositiveIntOutputs.getSingleton());

  return true;
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:19,代码来源:FreeTextSuggester.java

示例11: build

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public void build(InputIterator iterator) throws IOException {
  if (iterator.hasPayloads()) {
    throw new IllegalArgumentException("this suggester doesn't support payloads");
  }
  BytesRef scratch = new BytesRef();
  InputIterator iter = new WFSTInputIterator(iterator);
  IntsRef scratchInts = new IntsRef();
  BytesRef previous = null;
  PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
  Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, outputs);
  while ((scratch = iter.next()) != null) {
    long cost = iter.weight();
    
    if (previous == null) {
      previous = new BytesRef();
    } else if (scratch.equals(previous)) {
      continue; // for duplicate suggestions, the best weight is actually
                // added
    }
    Util.toIntsRef(scratch, scratchInts);
    builder.add(scratchInts, cost);
    previous.copyBytes(scratch);
  }
  fst = builder.finish();
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:27,代码来源:WFSTCompletionLookup.java

示例12: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(InputStream input) throws IOException {
  DataInput dataIn = new InputStreamDataInput(input);
  try {
    this.fst = new FST<>(dataIn, new PairOutputs<>(
        PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
    maxAnalyzedPathsForOneInput = dataIn.readVInt();
    hasPayloads = dataIn.readByte() == 1;
  } finally {
    IOUtils.close(input);
  }
  return true;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:XAnalyzingSuggester.java

示例13: XBuilder

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
public XBuilder(int maxSurfaceFormsPerAnalyzedForm, boolean hasPayloads, int payloadSep) {
    this.payloadSep = payloadSep;
    this.outputs = new PairOutputs<>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton());
    this.builder = new Builder<>(FST.INPUT_TYPE.BYTE1, outputs);
    this.maxSurfaceFormsPerAnalyzedForm = maxSurfaceFormsPerAnalyzedForm;
    this.hasPayloads = hasPayloads;
    surfaceFormsAndPayload = new SurfaceFormAndPayload[maxSurfaceFormsPerAnalyzedForm];

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:XAnalyzingSuggester.java

示例14: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(InputStream input) throws IOException {
  DataInput dataIn = new InputStreamDataInput(input);
  try {
    this.fst = new FST<>(dataIn, new PairOutputs<>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
    maxAnalyzedPathsForOneInput = dataIn.readVInt();
    hasPayloads = dataIn.readByte() == 1;
  } finally {
    IOUtils.close(input);
  }
  return true;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:XAnalyzingSuggester.java

示例15: TermsWriter

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
TermsWriter(FieldInfo fieldInfo) {
  this.numTerms = 0;
  this.fieldInfo = fieldInfo;
  this.longsSize = postingsWriter.setField(fieldInfo);
  this.outputs = PositiveIntOutputs.getSingleton();
  this.builder = new Builder<>(FST.INPUT_TYPE.BYTE1, outputs);

  this.lastBlockStatsFP = 0;
  this.lastBlockMetaLongsFP = 0;
  this.lastBlockMetaBytesFP = 0;
  this.lastBlockLongs = new long[longsSize];

  this.lastLongs = new long[longsSize];
  this.lastMetaBytesFP = 0;
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:FSTOrdTermsWriter.java


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