Package org.apache.lucene.facet.complements

Examples of org.apache.lucene.facet.complements.TotalFacetCounts


    DirectoryReader indexReader = DirectoryReader.open(indexDir);
    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);

    // As this is the first time we have invoked the TotalFacetCountsManager,
    // we should expect to compute and not read from disk.
    TotalFacetCounts totalCounts = TFC.getTotalCounts(indexReader, taxoReader, iParams);
    int prevGen = assertRecomputed(totalCounts, 0, "after first attempt to get it!");

    // Repeating same operation should pull from the cache - not recomputed.
    assertTrue("Should be obtained from cache at 2nd attempt",totalCounts ==
      TFC.getTotalCounts(indexReader, taxoReader, iParams));
View Full Code Here


    initCache();

    // With the bug, this next call should result in an exception
    TFC.load(outputFile, indexReader, taxoReader, iParams);
    TotalFacetCounts totalCounts = TFC.getTotalCounts(indexReader, taxoReader, iParams);
    assertReadFromDisc(totalCounts, 0, "after reading from disk.");
   
    outputFile.delete();
    IOUtils.close(indexWriter, taxoWriter, indexReader, taxoReader);
    IOUtils.close(indexDir, taxoDir);
View Full Code Here

    TaxonomyReader taxoReader1 = new DirectoryTaxonomyReader(taxoDir1);
    TaxonomyReader taxoReader2 = new DirectoryTaxonomyReader(taxoDir2);

    // As this is the first time we have invoked the TotalFacetCountsManager, we
    // should expect to compute.
    TotalFacetCounts totalCounts0 = TFC.getTotalCounts(indexReader1, taxoReader1, iParams);
    int prevGen = -1;
    prevGen = assertRecomputed(totalCounts0, prevGen, "after attempt 1");
    assertTrue("attempt 1b for same input [0] shout find it in cache",
        totalCounts0 == TFC.getTotalCounts(indexReader1, taxoReader1, iParams));
   
    // 2nd Reader - As this is the first time we have invoked the
    // TotalFacetCountsManager, we should expect a state of NEW to be returned.
    TotalFacetCounts totalCounts1 = TFC.getTotalCounts(indexReader2, taxoReader2, iParams);
    prevGen = assertRecomputed(totalCounts1, prevGen, "after attempt 2");
    assertTrue("attempt 2b for same input [1] shout find it in cache",
        totalCounts1 == TFC.getTotalCounts(indexReader2, taxoReader2, iParams));

    // Right now cache size is one, so first TFC is gone and should be recomputed 
View Full Code Here

    tfcc.store(tmpFile, indexReader, taxoReader, iParams);
    tfcc.clear(); // not really required because TFCC overrides on load(), but in the test we need not rely on this.
    tfcc.load(tmpFile, indexReader, taxoReader, iParams);
   
    // now retrieve the one just loaded
    TotalFacetCounts totalCounts = tfcc.getTotalCounts(indexReader, taxoReader, iParams);

    int partition = 0;
    for (int i = 0; i < expectedCounts.length; i += partitionSize) {
      totalCounts.fillTotalCountsForPartition(intArray, partition);
      int[] partitionExpectedCounts = new int[partitionSize];
      int nToCopy = Math.min(partitionSize,expectedCounts.length-i);
      System.arraycopy(expectedCounts, i, partitionExpectedCounts, 0, nToCopy);
      assertTrue("Wrong counts! for partition "+partition+
          "\nExpected:\n" + Arrays.toString(partitionExpectedCounts)+
View Full Code Here

TOP

Related Classes of org.apache.lucene.facet.complements.TotalFacetCounts

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.