Skip to content

Apache Lucene open-source search software

move FacetMerger public to make javadoc happy

Yonik Seeley5735b57b8498
diff --git a/solr/core/src/java/org/apache/solr/search/facet/FacetMerger.java b/solr/core/src/java/org/apache/solr/search/facet/FacetMerger.java
new file mode 100644
index 00000000000..44f95c70135
--- /dev/null
+++ b/solr/core/src/java/org/apache/solr/search/facet/FacetMerger.java
@@ -0,0 +1,33 @@
+package org.apache.solr.search.facet;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// The FacetMerger code is in the prototype stage, and this is the reason that
+// many implementations are all in this file. They can be moved to separate
+// files after the interfaces are locked down more.
+//
+public abstract class FacetMerger {
+ public abstract void merge(Object facetResult, Context mcontext);
+ public abstract Object getMergedResult();
+
+ public static class Context {
+ // FacetComponentState state; // todo: is this needed?
+ Object root;
+ }
+}
diff --git a/solr/core/src/java/org/apache/solr/search/facet/FacetModule.java b/solr/core/src/java/org/apache/solr/search/facet/FacetModule.java
index 90afd886b03..efeb654eab3 100644
--- a/solr/core/src/java/org/apache/solr/search/facet/FacetModule.java
+++ b/solr/core/src/java/org/apache/solr/search/facet/FacetModule.java
@@ -215,22 +215,6 @@ class FacetComponentState {
FacetMerger merger;
}
-//
-// The FacetMerger code is in the prototype stage, and this is the reason that
-// many implementations are all in this file. They can be moved to separate
-// files after the interfaces are locked down more.
-//
-
-abstract class FacetMerger {
- public abstract void merge(Object facetResult, Context mcontext);
- public abstract Object getMergedResult();
-
- public static class Context {
- FacetComponentState state; // todo: is this needed?
- Object root;
- }
-}
-
abstract class FacetSortableMerger extends FacetMerger {
public void prepareSort() {
@@ -307,6 +291,7 @@ class FacetLongMerger extends FacetSortableMerger {
// base class for facets that create buckets (and can hence have sub-facets)
abstract class FacetBucketMerger<FacetRequestT extends FacetRequest> extends FacetMerger {
FacetRequestT freq;
+ int bucketNumber;
public FacetBucketMerger(FacetRequestT freq) {
this.freq = freq;
@@ -314,7 +299,7 @@ abstract class FacetBucketMerger<FacetRequestT extends FacetRequest> extends Fac
/** Bucketval is the representative value for the bucket. Only applicable to terms and range queries to distinguish buckets. */
FacetBucket newBucket(Comparable bucketVal) {
- return new FacetBucket(this, bucketVal);
+ return new FacetBucket(this, bucketVal, bucketNumber++);
}
// do subs...
@@ -360,14 +345,17 @@ class FacetQueryMerger extends FacetBucketMerger<FacetQuery> {
class FacetBucket {
- FacetBucketMerger parent;
- Comparable bucketValue;
+ final FacetBucketMerger parent;
+ final Comparable bucketValue;
+ final int bucketNumber; // this is just for internal correlation (the first bucket created is bucket 0, the next bucket 1, etc)
+
long count;
Map<String, FacetMerger> subs;
- public FacetBucket(FacetBucketMerger parent, Comparable bucketValue) {
+ public FacetBucket(FacetBucketMerger parent, Comparable bucketValue, int bucketNumber) {
this.parent = parent;
this.bucketValue = bucketValue;
+ this.bucketNumber = bucketNumber;
}
public long getCount() {
@@ -448,7 +436,7 @@ class FacetFieldMerger extends FacetBucketMerger<FacetField> {
FacetBucket allBuckets;
FacetMerger numBuckets;
- LinkedHashMap<Object,FacetBucket> buckets = new LinkedHashMap<Object,FacetBucket>();
+ LinkedHashMap<Object,FacetBucket> buckets = new LinkedHashMap<>();
List<FacetBucket> sortedBuckets;
int numReturnedBuckets; // the number of buckets in the bucket lists returned from all of the shards
@@ -729,11 +717,6 @@ class FacetRangeMerger extends FacetBucketMerger<FacetRange> {
super(freq);
}
- @Override
- FacetBucket newBucket(Comparable bucketVal) {
- return super.newBucket(bucketVal);
- }
-
@Override
FacetMerger createFacetMerger(String key, Object val) {
return super.createFacetMerger(key, val);