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

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


   *            {@link LuceneIndexLocation}
   * @return the mapped {@link FacetSearchParams}
   * @author Sebastian Vogel <s.vogel@gentics.com>
   */
  private FacetSearchParams getFacetSearchParams(TaxonomyAccessor taAccessor) {
    FacetSearchParams params = new FacetSearchParams();

    for (TaxonomyMapping map : taAccessor.getTaxonomyMappings()) {
      CountFacetRequest req = new CountFacetRequest(new CategoryPath(
          map.getCategory()), facetnumbercategories);
      params.addFacetRequest(req);
      if (log.isDebugEnabled()) {
        log.debug("Added Category Path " + map.getCategory().toString()
            + " to the Facet Search Params");
      }
    }
View Full Code Here


   * @return
   * @author Sebastian Vogel <s.vogel@gentics.com>
   */
  public FacetsCollector createFacetsCollector(IndexReader indexReader,
      TaxonomyAccessor taAccessor, TaxonomyReader taReader) {
    FacetSearchParams facetSearchParams = getFacetSearchParams(taAccessor);
    FacetsCollector facetsCollector = new FacetsCollector(
        facetSearchParams, indexReader, taReader);
    return facetsCollector;
  }
View Full Code Here

    // currently it doesn't matter because we have to label all returned anyhow)
    boolean origAllowLabeling = isAllowLabeling();
    setAllowLabeling(false);

    // Replacing the original searchParams with the over-sampled (and without statistics-compute)
    FacetSearchParams original = delegee.searchParams;
    delegee.searchParams = sampler.overSampledSearchParams(original);
   
    SampleResult sampleSet = sampler.getSampleSet(docids);

    List<FacetResult> sampleRes = delegee.accumulate(sampleSet.docids);
View Full Code Here

  /**
   * Turn a base query into a drilling-down query using the default {@link FacetSearchParams} 
   * @see #query(FacetSearchParams, Query, CategoryPath...)
   */
  public static final Query query(Query baseQuery, CategoryPath... paths) {
    return query(new FacetSearchParams(), baseQuery, paths);
  }
View Full Code Here

  private void verifyResults(Directory dir, Directory taxDir) throws IOException {
    IndexReader reader1 = IndexReader.open(dir);
    LuceneTaxonomyReader taxReader = new LuceneTaxonomyReader(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

    // currently it doesn't matter because we have to label all returned anyhow)
    boolean origAllowLabeling = isAllowLabeling();
    setAllowLabeling(false);
   
    // Replacing the original searchParams with the over-sampled
    FacetSearchParams original = searchParams;
    searchParams = sampler.overSampledSearchParams(original);
   
    List<FacetResult> sampleRes = super.accumulate(docids);
    setAllowLabeling(origAllowLabeling);
   
View Full Code Here

  static TotalFacetCounts compute(final IndexReader indexReader,
      final TaxonomyReader taxonomy, final FacetIndexingParams facetIndexingParams,
      final CategoryListCache clCache) throws IOException {
    int partitionSize = PartitionsUtils.partitionSize(facetIndexingParams, taxonomy);
    final int[][] counts = new int[(int) Math.ceil(taxonomy.getSize()  /(float) partitionSize)][partitionSize];
    FacetSearchParams newSearchParams = new FacetSearchParams(facetIndexingParams);
      //createAllListsSearchParams(facetIndexingParams,  this.totalCounts);
    FacetsAccumulator fe = new StandardFacetsAccumulator(newSearchParams, indexReader, taxonomy) {
      @Override
      protected HashMap<CategoryListIterator, Aggregator> getCategoryListMap(
          FacetArrays facetArrays, int partition) throws IOException {
View Full Code Here

 
  /**
   * Over-sampled search params, wrapping each request with an over-sampled one.
   */
  public FacetSearchParams overSampledSearchParams(FacetSearchParams original) {
    FacetSearchParams res = original;
    // So now we can sample -> altering the searchParams to accommodate for the statistical error for the sampling
    double overSampleFactor = getSamplingParams().getOversampleFactor();
    if (overSampleFactor > 1) { // any factoring to do?
      res = new FacetSearchParams(original.getFacetIndexingParams());
      for (FacetRequest frq: original.getFacetRequests()) {
        int overSampledNumResults = (int) Math.ceil(frq.getNumResults() * overSampleFactor);
        res.addFacetRequest(new OverSampledFacetRequest(frq, overSampledNumResults));
      }
    }
    return res;
  }
View Full Code Here

  @Test
  public void testIntSumAssociation() throws Exception {
    LuceneTaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir);

    // facet requests for two facets
    FacetSearchParams fsp = new FacetSearchParams();
    fsp.addFacetRequest(new AssociationIntSumFacetRequest(aint, 10));
    fsp.addFacetRequest(new AssociationIntSumFacetRequest(bint, 10));
   
    Query q = new MatchAllDocsQuery();

    FacetsCollector fc = new FacetsCollector(fsp, reader, taxo);
   
View Full Code Here

  @Test
  public void testFloatSumAssociation() throws Exception {
    LuceneTaxonomyReader taxo = new LuceneTaxonomyReader(taxoDir);

    // facet requests for two facets
    FacetSearchParams fsp = new FacetSearchParams();
    fsp.addFacetRequest(new AssociationFloatSumFacetRequest(afloat, 10));
    fsp.addFacetRequest(new AssociationFloatSumFacetRequest(bfloat, 10));
   
    Query q = new MatchAllDocsQuery();

    FacetsCollector fc = new FacetsCollector(fsp, reader, taxo);
   
View Full Code Here

TOP

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

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.