Package org.apache.lucene.facet.search

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


    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

    FacetsCollector samplingFC = new FacetsCollector(samplingSearchParams, indexReader, taxoReader) {
      @Override
      protected FacetsAccumulator initFacetsAccumulator(
          FacetSearchParams facetSearchParams, IndexReader indexReader,
          TaxonomyReader taxonomyReader) {
        FacetsAccumulator acc = getSamplingAccumulator(sampler, taxonomyReader, indexReader, facetSearchParams);
        acc.setComplementThreshold(complement ? FacetsAccumulator.FORCE_COMPLEMENT : FacetsAccumulator.DISABLE_COMPLEMENT);
        return acc;
      }
    };
    return samplingFC;
  }
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

    // every category has a different type of association, so use chain their
    // respective aggregators.
    final Map<CategoryPath,FacetsAggregator> aggregators = new HashMap<CategoryPath,FacetsAggregator>();
    aggregators.put(tags, new SumIntAssociationFacetsAggregator());
    aggregators.put(genre, new SumFloatAssociationFacetsAggregator());
    FacetsAccumulator fa = new FacetsAccumulator(fsp, indexReader, taxoReader) {
      @Override
      public FacetsAggregator getAggregator() {
        return new MultiAssociationsFacetsAggregator(aggregators);
      }
    };
View Full Code Here

        nonRangeRequests.add(fr);
      }
    }

    if (rangeRequests.isEmpty()) {
      return new FacetsAccumulator(fsp, indexReader, taxoReader, arrays);
    } else if (nonRangeRequests.isEmpty()) {
      return new RangeAccumulator(fsp, indexReader);
    } else {
      FacetsAccumulator accumulator = new FacetsAccumulator(new FacetSearchParams(fsp.indexingParams, nonRangeRequests), indexReader, taxoReader, arrays);
      RangeAccumulator rangeAccumulator = new RangeAccumulator(new FacetSearchParams(fsp.indexingParams, rangeRequests), indexReader);
      return new RangeFacetsAccumulatorWrapper(accumulator, rangeAccumulator, fsp);
    }
  }
View Full Code Here

        new AssociationIntSumFacetRequest(aint, 10),
        new AssociationIntSumFacetRequest(bint, 10));
   
    Query q = new MatchAllDocsQuery();
   
    FacetsAccumulator fa = new FacetsAccumulator(fsp, reader, taxo) {
      @Override
      public FacetsAggregator getAggregator() {
        return new SumIntAssociationFacetsAggregator();
      }
    };
View Full Code Here

        new AssociationFloatSumFacetRequest(afloat, 10),
        new AssociationFloatSumFacetRequest(bfloat, 10));
   
    Query q = new MatchAllDocsQuery();
   
    FacetsAccumulator fa = new FacetsAccumulator(fsp, reader, taxo) {
      @Override
      public FacetsAggregator getAggregator() {
        return new SumFloatAssociationFacetsAggregator();
      }
    };
View Full Code Here

    final Map<CategoryPath,FacetsAggregator> aggregators = new HashMap<CategoryPath,FacetsAggregator>();
    aggregators.put(aint, sumInt);
    aggregators.put(bint, sumInt);
    aggregators.put(afloat, sumFloat);
    aggregators.put(bfloat, sumFloat);
    FacetsAccumulator fa = new FacetsAccumulator(fsp, reader, taxo) {
      @Override
      public FacetsAggregator getAggregator() {
        return new MultiAssociationsFacetsAggregator(aggregators);
      }
    };
View Full Code Here

TOP

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

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.