Examples of CountFacetRequest


Examples of org.apache.lucene.facet.search.CountFacetRequest

       
        // verify faceted search
        int id = Integer.parseInt(indexReader.getIndexCommit().getUserData().get(VERSION_ID), 16);
        CategoryPath cp = new CategoryPath("A", Integer.toString(id, 16));
        IndexSearcher searcher = new IndexSearcher(indexReader);
        FacetsCollector fc = FacetsCollector.create(new FacetSearchParams(new CountFacetRequest(cp, 10)), indexReader, taxoReader);
        searcher.search(new MatchAllDocsQuery(), fc);
        assertEquals(1, (int) fc.getFacetResults().get(0).getFacetResultNode().value);
       
        DrillDownQuery drillDown = new DrillDownQuery(FacetIndexingParams.DEFAULT);
        drillDown.add(cp);
View Full Code Here

Examples of org.apache.lucene.facet.search.CountFacetRequest

  private void verifyFacetedSearch(Map<String,Integer> expectedCounts, FacetIndexingParams fip,
      DirectoryReader indexReader, TaxonomyReader taxoReader, IndexSearcher searcher) throws IOException {
    // run faceted search and assert expected counts
    ArrayList<FacetRequest> requests = new ArrayList<FacetRequest>(expectedCounts.size());
    for (String dim : expectedCounts.keySet()) {
      requests.add(new CountFacetRequest(new CategoryPath(dim), 5));
    }
    FacetSearchParams fsp = new FacetSearchParams(fip, requests);
    FacetsCollector fc = FacetsCollector.create(fsp, indexReader, taxoReader);
    MatchAllDocsQuery base = new MatchAllDocsQuery();
    searcher.search(base, fc);
View Full Code Here

Examples of org.apache.lucene.facet.search.CountFacetRequest

  private void verifyDrillDown(Map<String,Integer> expectedCounts, FacetIndexingParams fip, DirectoryReader indexReader,
      TaxonomyReader taxoReader, IndexSearcher searcher) throws IOException {
    // verify drill-down
    for (String dim : expectedCounts.keySet()) {
      CategoryPath drillDownCP = new CategoryPath(dim);
      FacetSearchParams fsp = new FacetSearchParams(fip, new CountFacetRequest(drillDownCP, 10));
      DrillDownQuery drillDown = new DrillDownQuery(fip, new MatchAllDocsQuery());
      drillDown.add(drillDownCP);
      TotalHitCountCollector total = new TotalHitCountCollector();
      FacetsCollector fc = FacetsCollector.create(fsp, indexReader, taxoReader);
      searcher.search(drillDown, MultiCollector.wrap(fc, total));
View Full Code Here

Examples of org.apache.lucene.facet.search.CountFacetRequest

public class FacetRequestTest extends FacetTestCase {
 
  @Test(expected=IllegalArgumentException.class)
  public void testIllegalNumResults() throws Exception {
    assertNotNull(new CountFacetRequest(new CategoryPath("a", "b"), 0));
  }
View Full Code Here

Examples of org.apache.lucene.facet.search.CountFacetRequest

    assertNotNull(new CountFacetRequest(new CategoryPath("a", "b"), 0));
  }
 
  @Test(expected=IllegalArgumentException.class)
  public void testIllegalCategoryPath() throws Exception {
    assertNotNull(new CountFacetRequest(null, 1));
  }
View Full Code Here

Examples of org.apache.lucene.facet.search.CountFacetRequest

    assertNotNull(new CountFacetRequest(null, 1));
  }
 
  @Test
  public void testHashAndEquals() {
    CountFacetRequest fr1 = new CountFacetRequest(new CategoryPath("a"), 8);
    CountFacetRequest fr2 = new CountFacetRequest(new CategoryPath("a"), 8);
    assertEquals("hashCode() should agree on both objects", fr1.hashCode(), fr2.hashCode());
    assertTrue("equals() should return true", fr1.equals(fr2));
    fr1.setDepth(10);
    assertFalse("equals() should return false as fr1.depth != fr2.depth", fr1.equals(fr2));
  }
View Full Code Here

Examples of org.apache.lucene.facet.search.CountFacetRequest

    IndexSearcher searcher = new IndexSearcher(indexReader);
    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);

    // Count both "Publish Date" and "Author" dimensions
    FacetSearchParams fsp = new FacetSearchParams(
        new CountFacetRequest(new CategoryPath("Publish Date"), 10),
        new CountFacetRequest(new CategoryPath("Author"), 10));

    // Aggregates the facet counts
    FacetsCollector fc = FacetsCollector.create(fsp, searcher.getIndexReader(), taxoReader);

    // MatchAllDocsQuery is for "browsing" (counts facets
View Full Code Here

Examples of org.apache.lucene.facet.search.CountFacetRequest

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

    // Now user drills down on Publish Date/2010:
    FacetSearchParams fsp = new FacetSearchParams(new CountFacetRequest(new CategoryPath("Author"), 10));

    // Passing no baseQuery means we drill down on all
    // documents ("browse only"):
    DrillDownQuery q = new DrillDownQuery(fsp.indexingParams);
    q.add(new CategoryPath("Publish Date/2010", '/'));
View Full Code Here

Examples of org.apache.lucene.facet.search.CountFacetRequest

    IndexSearcher searcher = new IndexSearcher(indexReader);
    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);

    // Count both "Publish Date" and "Author" dimensions
    FacetSearchParams fsp = new FacetSearchParams(indexingParams,
        new CountFacetRequest(new CategoryPath("Publish Date"), 10),
        new CountFacetRequest(new CategoryPath("Author"), 10));

    // Aggregatses the facet counts
    FacetsCollector fc = FacetsCollector.create(fsp, searcher.getIndexReader(), taxoReader);

    // MatchAllDocsQuery is for "browsing" (counts facets
View Full Code Here

Examples of org.apache.lucene.facet.search.CountFacetRequest

    IndexSearcher searcher = new IndexSearcher(indexReader);
    SortedSetDocValuesReaderState state = new SortedSetDocValuesReaderState(indexReader);

    // Count both "Publish Year" and "Author" dimensions
    FacetSearchParams fsp = new FacetSearchParams(
        new CountFacetRequest(new CategoryPath("Publish Year"), 10),
        new CountFacetRequest(new CategoryPath("Author"), 10));

    // Aggregatses the facet counts
    FacetsCollector fc = FacetsCollector.create(new SortedSetDocValuesAccumulator(state, fsp));

    // MatchAllDocsQuery is for "browsing" (counts facets
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.