Package org.apache.lucene.facet

Examples of org.apache.lucene.facet.FacetsCollector$MatchingDocs


    IndexSearcher searcher = newSearcher(writer.getReader());

    // NRT open
    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);

    FacetsCollector c = new FacetsCollector();
    searcher.search(new MatchAllDocsQuery(), c);   

    // Uses default $facets field:
    Facets facets;
    if (random().nextBoolean()) {
View Full Code Here


    // NRT open
    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);
   
    // Aggregate the facet counts:
    FacetsCollector c = new FacetsCollector();

    // MatchAllDocsQuery is for "browsing" (counts facets
    // for all non-deleted docs in the index); normally
    // you'd use a "normal" query, and use MultiCollector to
    // wrap collecting the "normal" hits and also facets:
View Full Code Here

    IndexSearcher searcher = newSearcher(writer.getReader());

    // NRT open
    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);

    FacetsCollector c = new FacetsCollector();
    searcher.search(new MatchAllDocsQuery(), c);
   
    Facets facets = getTaxonomyFacetCounts(taxoReader, config, c);
    assertEquals(1, facets.getSpecificValue("dim", "test\u001Fone"));
    assertEquals(1, facets.getSpecificValue("dim", "test\u001Etwo"));
View Full Code Here

    IndexSearcher searcher = newSearcher(writer.getReader());

    // NRT open
    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);

    FacetsCollector c = new FacetsCollector();
    searcher.search(new MatchAllDocsQuery(), c);
   
    Facets facets = getTaxonomyFacetCounts(taxoReader, config, c);
    assertEquals(1, facets.getTopChildren(10, "dim").value);
    assertEquals(1, facets.getTopChildren(10, "dim2").value);
View Full Code Here

   
    // NRT open
    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);
   
    // Aggregate the facet counts:
    FacetsCollector c = new FacetsCollector();
   
    // MatchAllDocsQuery is for "browsing" (counts facets
    // for all non-deleted docs in the index); normally
    // you'd use a "normal" query, and use MultiCollector to
    // wrap collecting the "normal" hits and also facets:
View Full Code Here

    }
   
    DirectoryReader r = DirectoryReader.open(iw, true);
    DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);
   
    FacetsCollector sfc = new FacetsCollector();
    newSearcher(r).search(new MatchAllDocsQuery(), sfc);
    Facets facets1 = getTaxonomyFacetCounts(taxoReader, config, sfc);
    Facets facets2 = getTaxonomyFacetCounts(taxoReader, config, sfc, "$b");
    assertEquals(r.maxDoc(), facets1.getTopChildren(10, "a").value.intValue());
    assertEquals(r.maxDoc(), facets2.getTopChildren(10, "b").value.intValue());
View Full Code Here

    }
   
    DirectoryReader r = DirectoryReader.open(iw, true);
    DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);
   
    FacetsCollector sfc = new FacetsCollector();
    newSearcher(r).search(new MatchAllDocsQuery(), sfc);
    Facets facets = getTaxonomyFacetCounts(taxoReader, config, sfc);
    for (FacetResult result : facets.getAllDims(10)) {
      assertEquals(r.numDocs(), result.value.intValue());
    }
View Full Code Here

    iw.addDocument(config.build(taxoWriter, doc));
   
    DirectoryReader r = DirectoryReader.open(iw, true);
    DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);

    final FacetsCollector sfc = new FacetsCollector();
    newSearcher(r).search(new MatchAllDocsQuery(), sfc);

    Facets facets = getTaxonomyFacetCounts(taxoReader, config, sfc);
    List<FacetResult> res1 = facets.getAllDims(10);
    List<FacetResult> res2 = facets.getAllDims(10);
View Full Code Here

    }
   
    DirectoryReader r = DirectoryReader.open(iw, true);
    DirectoryTaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoWriter);
   
    FacetsCollector sfc = new FacetsCollector();
    newSearcher(r).search(new MatchAllDocsQuery(), sfc);
    Facets facets = getTaxonomyFacetCounts(taxoReader, config, sfc);
   
    assertEquals(10, facets.getTopChildren(2, "a").childCount);
View Full Code Here

    TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);
    IndexSearcher indexSearcher = newSearcher(indexReader);
   
    // search for "f:a", only segments 1 and 3 should match results
    Query q = new TermQuery(new Term("f", "a"));
    FacetsCollector sfc = new FacetsCollector();
    indexSearcher.search(q, sfc);
    Facets facets = getTaxonomyFacetCounts(taxoReader, config, sfc);
    FacetResult result = facets.getTopChildren(10, "A");
    assertEquals("wrong number of children", 2, result.labelValues.length);
    for (LabelAndValue labelValue : result.labelValues) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.facet.FacetsCollector$MatchingDocs

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.