Package org.apache.lucene.facet.search.params

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


    // docids collector for guiding facets accumulation (scoring disabled)
    ScoredDocIdCollector docIdsCollecor = ScoredDocIdCollector.create(indexReader.maxDoc(), false);
   
    // Faceted search parameters indicate which facets are we interested in
    FacetSearchParams facetSearchParams = new FacetSearchParams();
    facetSearchParams.addFacetRequest(new CountFacetRequest(new CategoryPath("root","a"), 10));
   
    // search, into both collectors. note: in case only facets accumulation
    // is required, the topDocCollector part can be totally discarded
    searcher.search(q, MultiCollector.wrap(topDocsCollector, docIdsCollecor));
       
View Full Code Here


  }
 
  @Override
  protected FacetSearchParams getFacetedSearchParams() {
    FacetSearchParams res = super.getFacetedSearchParams();
    res.addFacetRequest(new CountFacetRequest(new CategoryPath("root","a"), 10));
    return res;
  }
View Full Code Here

  }
 
  private void doTest(boolean withCache, boolean plantWrongData) throws IOException, Exception {
    Map<CategoryPath,Integer> truth = facetCountsTruth();
    CategoryPath cp = (CategoryPath) truth.keySet().toArray()[0]; // any category path will do for this test
    CountFacetRequest frq = new CountFacetRequest(cp, 10);
    FacetSearchParams sParams = getFacetedSearchParams();
    sParams.addFacetRequest(frq);
    if (withCache) {
      //let's use a cached cl data
      FacetIndexingParams iparams = sParams.getFacetIndexingParams();
View Full Code Here

   
    FacetSearchParams facetSearchParams = new FacetSearchParams(iParams);
    Collection<FacetRequest> fRequests = new ArrayList<FacetRequest>();
    for (String facetName : facetNames) {
      CategoryPath cp = new CategoryPath(facetName);
      FacetRequest fq = new CountFacetRequest(cp, k);
      facetSearchParams.addFacetRequest(fq);
      fRequests.add(fq);
    }

    TopScoreDocCollector topDocsCollector = TopScoreDocCollector.create(
View Full Code Here

   * @throws Exception on error (no detailed exception handling here for sample simplicity
   * @return facet results
   */
  public static List<FacetResult> searchWithFacets (IndexReader indexReader,
      TaxonomyReader taxoReader) throws Exception {
    CountFacetRequest facetRequest = new CountFacetRequest(new CategoryPath("root","a"), 10);
    return searchWithRequest(indexReader, taxoReader, null, facetRequest);
  }
View Full Code Here

    // base query the user is interested in
    Query baseQuery = new TermQuery(new Term(SimpleUtils.TEXT, "white"));

    // facet of interest
    CountFacetRequest facetRequest = new CountFacetRequest(new CategoryPath("root","a"), 10);
   
    // initial search - all docs matching the base query will contribute to the accumulation
    List<FacetResult> res1 = searchWithRequest(indexReader, taxoReader, null, facetRequest);
   
    // a single result (because there was a single request)
View Full Code Here

    // docids collector for guiding facets accumulation (scoring disabled)
    ScoredDocIdCollector docIdsCollecor = ScoredDocIdCollector.create(indexReader.maxDoc(), false);
   
    // Faceted search parameters indicate which facets are we interested in
    FacetSearchParams facetSearchParams = new FacetSearchParams();
    facetSearchParams.addFacetRequest(new CountFacetRequest(new CategoryPath("root","a"), 10));
   
    // search, into both collectors. note: in case only facets accumulation
    // is required, the topDocCollector part can be totally discarded
    searcher.search(q, MultiCollector.wrap(topDocsCollector, docIdsCollecor));
       
View Full Code Here

    TopScoreDocCollector topDocsCollector = TopScoreDocCollector.create(10,
        true);

    // Faceted search parameters indicate which facets are we interested in
    FacetSearchParams facetSearchParams = new FacetSearchParams(iParams);
    facetSearchParams.addFacetRequest(new CountFacetRequest(
        new CategoryPath("5"), 10));
    facetSearchParams.addFacetRequest(new CountFacetRequest(
        new CategoryPath("5", "5"), 10));
    facetSearchParams.addFacetRequest(new CountFacetRequest(
        new CategoryPath("6", "2"), 10));

    // Facets collector is the simplest interface for faceted search.
    // It provides faceted search functions that are sufficient to many
    // application,
View Full Code Here

   
    FacetSearchParams facetSearchParams = new FacetSearchParams(iParams);
    Collection<FacetRequest> fRequests = new ArrayList<FacetRequest>();
    for (String facetName : facetNames) {
      CategoryPath cp = new CategoryPath(facetName);
      FacetRequest fq = new CountFacetRequest(cp, k);
      facetSearchParams.addFacetRequest(fq);
      fRequests.add(fq);
    }

    TopScoreDocCollector topDocsCollector = TopScoreDocCollector.create(
View Full Code Here

  private void verifyResults(Directory dir, Directory taxDir) throws IOException {
    IndexReader reader1 = IndexReader.open(dir);
    DirectoryTaxonomyReader taxReader = new DirectoryTaxonomyReader(taxDir);
    IndexSearcher searcher = newSearcher(reader1);
    FacetSearchParams fsp = new FacetSearchParams();
    fsp.addFacetRequest(new CountFacetRequest(new CategoryPath("tag"), NUM_DOCS));
    FacetsCollector collector = new FacetsCollector(fsp, reader1, taxReader);
    searcher.search(new MatchAllDocsQuery(), collector);
    FacetResult result = collector.getFacetResults().get(0);
    FacetResultNode node = result.getFacetResultNode();
    for (FacetResultNode facet: node.getSubResults()) {
View Full Code Here

TOP

Related Classes of org.apache.lucene.facet.search.params.CountFacetRequest

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.