1 package org.apache.lucene.facet.search.params.association;
3 import java.io.IOException;
5 import org.apache.lucene.index.IndexReader;
7 import org.apache.lucene.facet.search.FacetArrays;
8 import org.apache.lucene.facet.search.aggregator.Aggregator;
9 import org.apache.lucene.facet.search.aggregator.association.AssociationFloatSumAggregator;
10 import org.apache.lucene.facet.search.params.FacetRequest;
11 import org.apache.lucene.facet.taxonomy.CategoryPath;
12 import org.apache.lucene.facet.taxonomy.TaxonomyReader;
15 * Licensed to the Apache Software Foundation (ASF) under one or more
16 * contributor license agreements. See the NOTICE file distributed with
17 * this work for additional information regarding copyright ownership.
18 * The ASF licenses this file to You under the Apache License, Version 2.0
19 * (the "License"); you may not use this file except in compliance with
20 * the License. You may obtain a copy of the License at
22 * http://www.apache.org/licenses/LICENSE-2.0
24 * Unless required by applicable law or agreed to in writing, software
25 * distributed under the License is distributed on an "AS IS" BASIS,
26 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27 * See the License for the specific language governing permissions and
28 * limitations under the License.
32 * Facet request for weighting facets according to their float association by
33 * summing the association values.
35 * @lucene.experimental
37 public class AssociationFloatSumFacetRequest extends FacetRequest {
40 * Create a float association facet request for a given node in the
43 public AssociationFloatSumFacetRequest(CategoryPath path, int num) {
48 public Aggregator createAggregator(boolean useComplements,
49 FacetArrays arrays, IndexReader reader,
50 TaxonomyReader taxonomy) throws IOException {
51 assert !useComplements : "complements are not supported by this FacetRequest";
52 return new AssociationFloatSumAggregator(reader, arrays.getFloatArray());
56 public double getValueOf(FacetArrays arrays, int ordinal) {
57 return arrays.getFloatArray()[ordinal];
61 public boolean supportsComplements() {
66 public boolean requireDocumentScore() {