Java 类org.apache.lucene.search.suggest.Sort.SortInfo 实例源码

项目:NYBC    文件:TestSort.java   
@Test
public void testIntermediateMerges() throws Exception {
  // Sort 20 mb worth of data with 1mb buffer, binary merging.
  SortInfo info = checkSort(new Sort(Sort.DEFAULT_COMPARATOR, BufferSize.megabytes(1), Sort.defaultTempDir(), 2), 
      generateRandom((int)Sort.MB * 20));
  assertTrue(info.mergeRounds > 10);
}
项目:NYBC    文件:TestSort.java   
@Test
public void testSmallRandom() throws Exception {
  // Sort 20 mb worth of data with 1mb buffer.
  SortInfo sortInfo = checkSort(new Sort(Sort.DEFAULT_COMPARATOR, BufferSize.megabytes(1), Sort.defaultTempDir(), Sort.MAX_TEMPFILES), 
      generateRandom((int)Sort.MB * 20));
  assertEquals(1, sortInfo.mergeRounds);
}
项目:NYBC    文件:TestSort.java   
/**
 * Check sorting data on an instance of {@link Sort}.
 */
private SortInfo checkSort(Sort sort, byte[][] data) throws IOException {
  File unsorted = writeAll("unsorted", data);

  Arrays.sort(data, unsignedByteOrderComparator);
  File golden = writeAll("golden", data);

  File sorted = new File(tempDir, "sorted");
  SortInfo sortInfo = sort.sort(unsorted, sorted);
  //System.out.println("Input size [MB]: " + unsorted.length() / (1024 * 1024));
  //System.out.println(sortInfo);

  assertFilesIdentical(golden, sorted);
  return sortInfo;
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestSort.java   
@Test
public void testIntermediateMerges() throws Exception {
  // Sort 20 mb worth of data with 1mb buffer, binary merging.
  SortInfo info = checkSort(new Sort(Sort.DEFAULT_COMPARATOR, BufferSize.megabytes(1), Sort.defaultTempDir(), 2), 
      generateRandom((int)Sort.MB * 20));
  assertTrue(info.mergeRounds > 10);
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestSort.java   
@Test
public void testSmallRandom() throws Exception {
  // Sort 20 mb worth of data with 1mb buffer.
  SortInfo sortInfo = checkSort(new Sort(Sort.DEFAULT_COMPARATOR, BufferSize.megabytes(1), Sort.defaultTempDir(), Sort.MAX_TEMPFILES), 
      generateRandom((int)Sort.MB * 20));
  assertEquals(1, sortInfo.mergeRounds);
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestSort.java   
/**
 * Check sorting data on an instance of {@link Sort}.
 */
private SortInfo checkSort(Sort sort, byte[][] data) throws IOException {
  File unsorted = writeAll("unsorted", data);

  Arrays.sort(data, unsignedByteOrderComparator);
  File golden = writeAll("golden", data);

  File sorted = new File(tempDir, "sorted");
  SortInfo sortInfo = sort.sort(unsorted, sorted);
  //System.out.println("Input size [MB]: " + unsorted.length() / (1024 * 1024));
  //System.out.println(sortInfo);

  assertFilesIdentical(golden, sorted);
  return sortInfo;
}