Package org.apache.lucene.search.suggest

Examples of org.apache.lucene.search.suggest.Sort


      _TestUtil.rmDir(tempDir);
  }

  @Test
  public void testEmpty() throws Exception {
    checkSort(new Sort(), new byte [][] {});
  }
View Full Code Here


    checkSort(new Sort(), new byte [][] {});
  }

  @Test
  public void testSingleLine() throws Exception {
    checkSort(new Sort(), new byte [][] {
        "Single line only.".getBytes("UTF-8")
    });
  }
View Full Code Here

  }

  @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);
  }
View Full Code Here

  }

  @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);
  }
View Full Code Here

  }

  @Test @Nightly
  public void testLargerRandom() throws Exception {
    // Sort 100MB worth of data with 15mb buffer.
    checkSort(new Sort(Sort.DEFAULT_COMPARATOR, BufferSize.megabytes(16), Sort.defaultTempDir(), Sort.MAX_TEMPFILES),
        generateRandom((int)Sort.MB * 100));
  }
View Full Code Here

import org.junit.Test;

public class BytesRefSortersTest extends LuceneTestCase {
  @Test
  public void testExternalRefSorter() throws Exception {
    ExternalRefSorter s = new ExternalRefSorter(new Sort());
    check(s);
    s.close();
  }
View Full Code Here

    File input = new File("/home/dweiss/tmp/shuffled.dict");

    int buckets = 20;
    int shareMaxTail = 10;

    ExternalRefSorter sorter = new ExternalRefSorter(new Sort());
    FSTCompletionBuilder builder = new FSTCompletionBuilder(buckets, sorter, shareMaxTail);

    BufferedReader reader = new BufferedReader(
        new InputStreamReader(
            new FileInputStream(input), "UTF-8"));
View Full Code Here

        }
      }
      writer.close();

      // Sort all input/output pairs (required by FST.Builder):
      new Sort(new AnalyzingComparator(hasPayloads)).sort(tempInput, tempSorted);

      // Free disk space:
      tempInput.delete();

      reader = new Sort.ByteSequencesReader(tempSorted);
View Full Code Here

      }
      writer.close();

      // We don't know the distribution of scores and we need to bucket them, so we'll sort
      // and divide into equal buckets.
      SortInfo info = new Sort().sort(tempInput, tempSorted);
      tempInput.delete();
      FSTCompletionBuilder builder = new FSTCompletionBuilder(
          buckets, sorter = new ExternalRefSorter(new Sort()), sharedTailLength);

      final int inputLines = info.lines;
      reader = new Sort.ByteSequencesReader(tempSorted);
      long line = 0;
      int previousBucket = 0;
View Full Code Here

        count++;
      }
      writer.close();

      // Sort all input/output pairs (required by FST.Builder):
      new Sort(new AnalyzingComparator(hasPayloads)).sort(tempInput, tempSorted);

      // Free disk space:
      tempInput.delete();

      reader = new Sort.ByteSequencesReader(tempSorted);
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.suggest.Sort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.