Package org.apache.lucene.facet.search

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


    sParams.setClCache(clCache);
    for (String dim : dimension) {
      sParams.addFacetRequest(new PerDimCountFacetRequest(
          new CategoryPath(dim), 10));
    }
    FacetsAccumulator acc = new StandardFacetsAccumulator(sParams, reader, taxo);
   
    // no use to test this with complement since at that mode all facets are taken
    acc.setComplementThreshold(FacetsAccumulator.DISABLE_COMPLEMENT);

    List<FacetResult> results = acc.accumulate(allDocs);
    assertEquals("Wrong #results", dimension.length, results.size());

    for (int i = 0; i < results.size(); i++) {
      FacetResult res = results.get(i);
      assertEquals("wrong num-descendants for dimension " + dimension[i],
View Full Code Here


  }

  // compute facets with certain facet requests and docs
  private List<FacetResult> findFacets(ScoredDocIDs sDocids,
      FacetSearchParams facetSearchParams) throws IOException {
    FacetsAccumulator fAccumulator = new StandardFacetsAccumulator(
        facetSearchParams, indexReader, taxoReader);
    List<FacetResult> res = fAccumulator.accumulate(sDocids);

    // Results are ready, printing them...
    int i = 0;
    for (FacetResult facetResult : res) {
      if (VERBOSE) {
View Full Code Here

      facetSearchParams.addFacetRequest(doctor);
      facetSearchParams.addFacetRequest(cfrb20);
     
      IntArrayAllocator iaa = new IntArrayAllocator(PartitionsUtils.partitionSize(facetSearchParams,tr), 1);
      FloatArrayAllocator faa = new FloatArrayAllocator(PartitionsUtils.partitionSize(facetSearchParams,tr), 1);
      FacetsAccumulator fctExtrctr = new StandardFacetsAccumulator(facetSearchParams, is.getIndexReader(), tr, iaa, faa);
      fctExtrctr.setComplementThreshold(FacetsAccumulator.DISABLE_COMPLEMENT);
      long start = System.currentTimeMillis();

      List<FacetResult> facetResults = fctExtrctr.accumulate(scoredDoc.getScoredDocIDs());

      long end = System.currentTimeMillis();
      if (VERBOSE) {
        System.out.println("Time: " + (end - start));
      }
View Full Code Here

 
  /** compute facets with certain facet requests and docs */
  private List<FacetResult> findFacets(ScoredDocIDs sDocids, boolean withComplement) throws IOException {
   
    FacetsAccumulator fAccumulator =
      new StandardFacetsAccumulator(getFacetedSearchParams(), indexReader, taxoReader);
   
    fAccumulator.setComplementThreshold(
        withComplement ?
            FacetsAccumulator.FORCE_COMPLEMENT:
              FacetsAccumulator.DISABLE_COMPLEMENT);
   
    List<FacetResult> res = fAccumulator.accumulate(sDocids);
   
    // Results are ready, printing them...
    int i = 0;
    for (FacetResult facetResult : res) {
      if (VERBOSE) {
View Full Code Here

  /** search reader <code>r</code>*/
  private FacetResult searchWithFacets(IndexReader r, TaxonomyReader tr, FacetSearchParams fsp,
      final SamplingParams params) throws IOException {
    // a FacetsCollector with a sampling accumulator
    Sampler sampler = new RandomSampler(params, random());
    StandardFacetsAccumulator sfa = new SamplingAccumulator(sampler, fsp, r, tr);
    FacetsCollector fcWithSampling = FacetsCollector.create(sfa);
   
    IndexSearcher s = new IndexSearcher(r);
    s.search(new MatchAllDocsQuery(), fcWithSampling);
   
View Full Code Here

    assertSameResults(expected, sampledResults);
  }
 
  private FacetsCollector samplingCollector(final boolean complement, final Sampler sampler,
      FacetSearchParams samplingSearchParams) {
    StandardFacetsAccumulator sfa = getSamplingAccumulator(sampler, taxoReader, indexReader, samplingSearchParams);
    sfa.setComplementThreshold(complement ? StandardFacetsAccumulator.FORCE_COMPLEMENT : StandardFacetsAccumulator.DISABLE_COMPLEMENT);
    return FacetsCollector.create(sfa);
  }
View Full Code Here

  }
 
  /** compute facets with certain facet requests and docs */
  private List<FacetResult> findFacets(boolean withComplement) throws IOException {
    FacetSearchParams fsp = new FacetSearchParams(fip, new CountFacetRequest(new CategoryPath("root","a"), 10));
    StandardFacetsAccumulator sfa = new StandardFacetsAccumulator(fsp, indexReader, taxoReader);
    sfa.setComplementThreshold(withComplement ? StandardFacetsAccumulator.FORCE_COMPLEMENT : StandardFacetsAccumulator.DISABLE_COMPLEMENT);
    FacetsCollector fc = FacetsCollector.create(sfa);
    searcher.search(new MatchAllDocsQuery(), fc);
   
    List<FacetResult> res = fc.getFacetResults();
   
    // Results are ready, printing them...
    int i = 0;
    if (VERBOSE) {
      for (FacetResult facetResult : res) {
        System.out.println("Res "+(i++)+": "+facetResult);
      }
    }
   
    assertEquals(withComplement, sfa.isUsingComplements());
   
    return res;
  }
View Full Code Here

  /** search reader <code>r</code>*/
  private FacetResult searchWithFacets(IndexReader r, TaxonomyReader tr, FacetSearchParams fsp,
      final SamplingParams params) throws IOException {
    // a FacetsCollector with a sampling accumulator
    Sampler sampler = new RandomSampler(params, random());
    StandardFacetsAccumulator sfa = new SamplingAccumulator(sampler, fsp, r, tr);
    FacetsCollector fcWithSampling = FacetsCollector.create(sfa);
   
    IndexSearcher s = newSearcher(r);
    s.search(new MatchAllDocsQuery(), fcWithSampling);
   
View Full Code Here

    assertSameResults(expected, sampledResults);
  }
 
  private FacetsCollector samplingCollector(final boolean complement, final Sampler sampler,
      FacetSearchParams samplingSearchParams) {
    StandardFacetsAccumulator sfa = getSamplingAccumulator(sampler, taxoReader, indexReader, samplingSearchParams);
    sfa.setComplementThreshold(complement ? StandardFacetsAccumulator.FORCE_COMPLEMENT : StandardFacetsAccumulator.DISABLE_COMPLEMENT);
    return FacetsCollector.create(sfa);
  }
View Full Code Here

  }
 
  /** compute facets with certain facet requests and docs */
  private List<FacetResult> findFacets(boolean withComplement) throws IOException {
    FacetSearchParams fsp = new FacetSearchParams(fip, new CountFacetRequest(new CategoryPath("root","a"), 10));
    StandardFacetsAccumulator sfa = new StandardFacetsAccumulator(fsp, indexReader, taxoReader);
    sfa.setComplementThreshold(withComplement ? StandardFacetsAccumulator.FORCE_COMPLEMENT : StandardFacetsAccumulator.DISABLE_COMPLEMENT);
    FacetsCollector fc = FacetsCollector.create(sfa);
    searcher.search(new MatchAllDocsQuery(), fc);
   
    List<FacetResult> res = fc.getFacetResults();
   
    // Results are ready, printing them...
    int i = 0;
    for (FacetResult facetResult : res) {
      if (VERBOSE) {
        System.out.println("Res "+(i++)+": "+facetResult);
      }
    }
   
    assertEquals(withComplement, sfa.isUsingComplements());
   
    return res;
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.facet.search.StandardFacetsAccumulator

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.