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


Java ByteSequencesReader类代码示例

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


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

示例1: iterator

import org.apache.lucene.search.suggest.Sort.ByteSequencesReader; //导入依赖的package包/类
@Override
public BytesRefIterator iterator() throws IOException {
  if (sorted == null) {
    closeWriter();
    
    sorted = File.createTempFile("RefSorter-", ".sorted",
        Sort.defaultTempDir());
    sort.sort(input, sorted);
    
    input.delete();
    input = null;
  }
  
  return new ByteSequenceIterator(new Sort.ByteSequencesReader(sorted),
      sort.getComparator());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:17,代码来源:ExternalRefSorter.java

示例2: sort

import org.apache.lucene.search.suggest.Sort.ByteSequencesReader; //导入依赖的package包/类
private Sort.ByteSequencesReader sort() throws IOException {
  String prefix = getClass().getSimpleName();
  File directory = Sort.defaultTempDir();
  tempInput = File.createTempFile(prefix, ".input", directory);
  tempSorted = File.createTempFile(prefix, ".sorted", directory);
  
  final Sort.ByteSequencesWriter writer = new Sort.ByteSequencesWriter(tempInput);
  boolean success = false;
  try {
    BytesRef spare;
    byte[] buffer = new byte[0];
    ByteArrayDataOutput output = new ByteArrayDataOutput(buffer);

    while ((spare = source.next()) != null) {
      encode(writer, output, buffer, spare, source.weight());
    }
    writer.close();
    new Sort(tieBreakByCostComparator).sort(tempInput, tempSorted);
    ByteSequencesReader reader = new Sort.ByteSequencesReader(tempSorted);
    success = true;
    return reader;
    
  } finally {
    if (success) {
      IOUtils.close(writer);
    } else {
      try {
        IOUtils.closeWhileHandlingException(writer);
      } finally {
        close();
      }
    }
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:35,代码来源:SortedTermFreqIteratorWrapper.java

示例3: sort

import org.apache.lucene.search.suggest.Sort.ByteSequencesReader; //导入依赖的package包/类
private Sort.ByteSequencesReader sort() throws IOException {
  String prefix = getClass().getSimpleName();
  File directory = Sort.defaultTempDir();
  tempInput = File.createTempFile(prefix, ".input", directory);
  tempSorted = File.createTempFile(prefix, ".sorted", directory);
  
  final Sort.ByteSequencesWriter writer = new Sort.ByteSequencesWriter(tempInput);
  boolean success = false;
  try {
    BytesRef spare;
    byte[] buffer = new byte[0];
    ByteArrayDataOutput output = new ByteArrayDataOutput(buffer);

    while ((spare = source.next()) != null) {
      encode(writer, output, buffer, spare, source.payload(), source.weight());
    }
    writer.close();
    new Sort(tieBreakByCostComparator).sort(tempInput, tempSorted);
    ByteSequencesReader reader = new Sort.ByteSequencesReader(tempSorted);
    success = true;
    return reader;
    
  } finally {
    if (success) {
      IOUtils.close(writer);
    } else {
      try {
        IOUtils.closeWhileHandlingException(writer);
      } finally {
        close();
      }
    }
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:35,代码来源:SortedInputIterator.java

示例4: ByteSequenceIterator

import org.apache.lucene.search.suggest.Sort.ByteSequencesReader; //导入依赖的package包/类
public ByteSequenceIterator(ByteSequencesReader reader,
    Comparator<BytesRef> comparator) {
  this.reader = reader;
  this.comparator = comparator;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:6,代码来源:ExternalRefSorter.java


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