Package org.apache.lucene.facet.range

Examples of org.apache.lucene.facet.range.RangeAccumulator


    }

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


    }
   
    if (rangeRequests.isEmpty()) {
      return new SortedSetDocValuesAccumulator(state, fsp, arrays);
    } else if (nonRangeRequests.isEmpty()) {
      return new RangeAccumulator(rangeRequests);
    } else {
      FacetSearchParams searchParams = new FacetSearchParams(fsp.indexingParams, nonRangeRequests);
      FacetsAccumulator accumulator = new SortedSetDocValuesAccumulator(state, searchParams, arrays);
      RangeAccumulator rangeAccumulator = new RangeAccumulator(rangeRequests);
      return MultiFacetsAccumulator.wrap(accumulator, rangeAccumulator);
    }
  }
View Full Code Here

      fail("should not have succeeded to execute a request over a category which wasn't indexed as SortedSetDVField");
    } catch (IllegalArgumentException e) {
      // expected
    }

    RangeAccumulator ra = new RangeAccumulator(new RangeFacetRequest<LongRange>("f", new LongRange("grr", 0, true, 1, true)));
    FacetsCollector fc = FacetsCollector.create(ra);
    searcher.search(new MatchAllDocsQuery(), fc);
    List<FacetResult> facetResults = fc.getFacetResults();
    assertNotNull(facetResults);
    assertEquals("incorrect label returned for RangeAccumulator", new CategoryPath("f"), facetResults.get(0).getFacetResultNode().label);
View Full Code Here

    RangeFacetRequest<LongRange> rangeFacetRequest = new RangeFacetRequest<LongRange>("timestamp",
                                     new LongRange("Past hour", nowSec-3600, true, nowSec, true),
                                     new LongRange("Past six hours", nowSec-6*3600, true, nowSec, true),
                                     new LongRange("Past day", nowSec-24*3600, true, nowSec, true));
    // Aggregatses the facet counts
    FacetsCollector fc = FacetsCollector.create(new RangeAccumulator(rangeFacetRequest));

    // 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

      fail("should not have succeeded to execute a request over a category which wasn't indexed as SortedSetDVField");
    } catch (IllegalArgumentException e) {
      // expected
    }

    RangeAccumulator ra = new RangeAccumulator(new RangeFacetRequest<LongRange>("f", new LongRange("grr", 0, true, 1, true)));
    FacetsCollector fc = FacetsCollector.create(ra);
    searcher.search(new MatchAllDocsQuery(), fc);
    List<FacetResult> facetResults = fc.getFacetResults();
    assertNotNull(facetResults);
    assertEquals("incorrect label returned for RangeAccumulator", new CategoryPath("f"), facetResults.get(0).getFacetResultNode().label);
View Full Code Here

    } catch (IllegalArgumentException e) {
      // expected
    }

    fsp = new FacetSearchParams(new RangeFacetRequest<LongRange>("f", new LongRange("grr", 0, true, 1, true)));
    RangeAccumulator ra = new RangeAccumulator(fsp, indexReader);
    FacetsCollector fc = FacetsCollector.create(ra);
    searcher.search(new MatchAllDocsQuery(), fc);
    List<FacetResult> facetResults = fc.getFacetResults();
    assertNotNull(facetResults);
    assertEquals("incorrect label returned for RangeAccumulator", fsp.facetRequests.get(0).categoryPath, facetResults.get(0).getFacetResultNode().label);
View Full Code Here

                                new RangeFacetRequest<LongRange>("timestamp",
                                                                 new LongRange("Past hour", nowSec-3600, true, nowSec, true),
                                                                 new LongRange("Past six hours", nowSec-6*3600, true, nowSec, true),
                                                                 new LongRange("Past day", nowSec-24*3600, true, nowSec, true)));
    // Aggregatses the facet counts
    FacetsCollector fc = FacetsCollector.create(new RangeAccumulator(fsp, searcher.getIndexReader()));

    // 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

TOP

Related Classes of org.apache.lucene.facet.range.RangeAccumulator

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.