Package org.apache.lucene.facet.params

Examples of org.apache.lucene.facet.params.CategoryListParams


      return Collections.singletonMap(searchParams.indexingParams.getCategoryListParams(null), searchParams.facetRequests);
    }
   
    HashMap<CategoryListParams,List<FacetRequest>> requestsPerCLP = new HashMap<CategoryListParams,List<FacetRequest>>();
    for (FacetRequest fr : searchParams.facetRequests) {
      CategoryListParams clp = searchParams.indexingParams.getCategoryListParams(fr.categoryPath);
      List<FacetRequest> requests = requestsPerCLP.get(clp);
      if (requests == null) {
        requests = new ArrayList<FacetRequest>();
        requestsPerCLP.put(clp, requests);
      }
View Full Code Here


    // If we're here it means the facet requests are spread across multiple
    // category lists, or there are multiple types of facet requests, or both.
    // Therefore create a per-CategoryList mapping of FacetsAggregators.
    Map<CategoryListParams,FacetsAggregator> perCLPAggregator = new HashMap<CategoryListParams,FacetsAggregator>();
    for (Entry<CategoryListParams,List<FacetRequest>> e : requestsPerCLP.entrySet()) {
      CategoryListParams clp = e.getKey();
      List<FacetRequest> requests = e.getValue();
      Map<Class<? extends FacetsAggregator>,FacetsAggregator> aggClasses = new HashMap<Class<? extends FacetsAggregator>,FacetsAggregator>();
      Map<CategoryPath,FacetsAggregator> perCategoryAggregator = new HashMap<CategoryPath,FacetsAggregator>();
      for (FacetRequest fr : requests) {
        FacetsAggregator fa = fr.createFacetsAggregator(searchParams.indexingParams);
View Full Code Here

      if (rootOrd == TaxonomyReader.INVALID_ORDINAL) { // category does not exist
        // Add empty FacetResult
        res.add(emptyResult(rootOrd, fr));
        continue;
      }
      CategoryListParams clp = searchParams.indexingParams.getCategoryListParams(fr.categoryPath);
      if (fr.categoryPath.length > 0) { // someone might ask to aggregate the ROOT category
        OrdinalPolicy ordinalPolicy = clp.getOrdinalPolicy(fr.categoryPath.components[0]);
        if (ordinalPolicy == OrdinalPolicy.NO_PARENTS) {
          // rollup values
          aggregator.rollupValues(fr, rootOrd, children, siblings, facetArrays);
        }
      }
View Full Code Here

    }

    final Map<CategoryListParams,Iterable<CategoryPath>> categoryLists = createCategoryListMapping(categories);
    for (Entry<CategoryListParams, Iterable<CategoryPath>> e : categoryLists.entrySet()) {

      CategoryListParams clp = e.getKey();
      String dvField = clp.field + SortedSetDocValuesReaderState.FACET_FIELD_EXTENSION;

      // Add sorted-set DV fields, one per value:
      for(CategoryPath cp : e.getValue()) {
        if (cp.length != 2) {
View Full Code Here

    CategoryAssociationsContainer categoryAssociations = (CategoryAssociationsContainer) categories;
    HashMap<CategoryListParams,Iterable<CategoryPath>> categoryLists =
        new HashMap<CategoryListParams,Iterable<CategoryPath>>();
    for (CategoryPath cp : categories) {
      // each category may be indexed under a different field, so add it to the right list.
      CategoryListParams clp = indexingParams.getCategoryListParams(cp);
      CategoryAssociationsContainer clpContainer = (CategoryAssociationsContainer) categoryLists.get(clp);
      if (clpContainer == null) {
        clpContainer = new CategoryAssociationsContainer();
        categoryLists.put(clp, clpContainer);
      }
View Full Code Here

*/
public final class DrillDownQuery extends Query {

  /** Return a drill-down {@link Term} for a category. */
  public static Term term(FacetIndexingParams iParams, CategoryPath path) {
    CategoryListParams clp = iParams.getCategoryListParams(path);
    char[] buffer = new char[path.fullPathLength()];
    iParams.drillDownTermText(path, buffer);
    return new Term(clp.field, String.valueOf(buffer));
  }
View Full Code Here

    aggregators.get(clp).aggregate(matchingDocs, clp, facetArrays);
  }
 
  @Override
  public void rollupValues(FacetRequest fr, int ordinal, int[] children, int[] siblings, FacetArrays facetArrays) {
    CategoryListParams clp = fip.getCategoryListParams(fr.categoryPath);
    aggregators.get(clp).rollupValues(fr, ordinal, children, siblings, facetArrays);
  }
View Full Code Here

    return false;
  }

  @Override
  public OrdinalValueResolver createOrdinalValueResolver(FacetRequest facetRequest, FacetArrays arrays) {
    CategoryListParams clp = fip.getCategoryListParams(facetRequest.categoryPath);
    return aggregators.get(clp).createOrdinalValueResolver(facetRequest, arrays);
  }
View Full Code Here

    FacetIndexingParams fip = fipPerPartitionSize.get(partSize);
    if (fip == null) {
      // randomize OrdinalPolicy. Since not all Collectors / Accumulators
      // support NO_PARENTS, don't include it.
      // TODO: once all code paths support NO_PARENTS, randomize it too.
      CategoryListParams randomOP = new CategoryListParams() {
        final OrdinalPolicy op = random().nextBoolean() ? OrdinalPolicy.ALL_BUT_DIMENSION : OrdinalPolicy.ALL_PARENTS;
        @Override
        public OrdinalPolicy getOrdinalPolicy(String dimension) {
          return forceAllParents ? OrdinalPolicy.ALL_PARENTS : op;
        }
View Full Code Here

 
  /** Returns a {@link CategoryListParams} with random {@link IntEncoder}. */
  public static CategoryListParams randomCategoryListParams(String field) {
    Random random = random();
    final IntEncoder encoder = ENCODERS[random.nextInt(ENCODERS.length)];
    return new CategoryListParams(field) {
      @Override
      public IntEncoder createEncoder() {
        return encoder;
      }
    };
View Full Code Here

TOP

Related Classes of org.apache.lucene.facet.params.CategoryListParams

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.