當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。