Skip to content

Apache Lucene open-source search software

Move non-inner classes to separate files: This breaks IDEs and update checks by javac

Uwe Schindlerae93f4e7ac6a
diff --git a/solr/core/src/java/org/apache/solr/search/facet/UniqueMultiDvSlotAcc.java b/solr/core/src/java/org/apache/solr/search/facet/UniqueMultiDvSlotAcc.java
new file mode 100644
index 00000000000..4c297534f7a
--- /dev/null
+++ b/solr/core/src/java/org/apache/solr/search/facet/UniqueMultiDvSlotAcc.java
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+package org.apache.solr.search.facet;
+
+import java.io.IOException;
+
+import org.apache.lucene.index.LeafReaderContext;
+import org.apache.lucene.index.MultiDocValues;
+import org.apache.lucene.index.SortedSetDocValues;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.FixedBitSet;
+import org.apache.lucene.util.LongValues;
+import org.apache.solr.search.SolrIndexSearcher;
+
+class UniqueMultiDvSlotAcc extends UniqueSlotAcc {
+ final SortedSetDocValues topLevel;
+ final SortedSetDocValues[] subDvs;
+ final MultiDocValues.OrdinalMap ordMap;
+ LongValues toGlobal;
+ SortedSetDocValues subDv;
+
+ public UniqueMultiDvSlotAcc(FacetContext fcontext, String field, int numSlots, HLLAgg.HLLFactory factory) throws IOException {
+ super(fcontext, field, numSlots, factory);
+ SolrIndexSearcher searcher = fcontext.qcontext.searcher();
+ topLevel = FieldUtil.getSortedSetDocValues(fcontext.qcontext, searcher.getSchema().getField(field), null);
+ nTerms = (int) topLevel.getValueCount();
+ if (topLevel instanceof MultiDocValues.MultiSortedSetDocValues) {
+ ordMap = ((MultiDocValues.MultiSortedSetDocValues) topLevel).mapping;
+ subDvs = ((MultiDocValues.MultiSortedSetDocValues) topLevel).values;
+ } else {
+ ordMap = null;
+ subDvs = null;
+ }
+ }
+
+ @Override
+ protected BytesRef lookupOrd(int ord) {
+ return topLevel.lookupOrd(ord);
+ }
+
+ @Override
+ public void setNextReader(LeafReaderContext readerContext) throws IOException {
+ super.setNextReader(readerContext);
+ if (subDvs != null) {
+ subDv = subDvs[readerContext.ord];
+ toGlobal = ordMap.getGlobalOrds(readerContext.ord);
+ } else {
+ assert readerContext.ord==0 || topLevel.getValueCount() == 0;
+ subDv = topLevel;
+ }
+ }
+
+ @Override
+ public void collect(int doc, int slotNum) {
+ subDv.setDocument(doc);
+ int segOrd = (int) subDv.nextOrd();
+ if (segOrd < 0) return;
+
+ FixedBitSet bits = arr[slotNum];
+ if (bits == null) {
+ bits = new FixedBitSet(nTerms);
+ arr[slotNum] = bits;
+ }
+
+ do {
+ int ord = toGlobal == null ? segOrd : (int) toGlobal.get(segOrd);
+ bits.set(ord);
+ segOrd = (int) subDv.nextOrd();
+ } while (segOrd >= 0);
+ }
+}
\ No newline at end of file
diff --git a/solr/core/src/java/org/apache/solr/search/facet/UniqueMultivaluedSlotAcc.java b/solr/core/src/java/org/apache/solr/search/facet/UniqueMultivaluedSlotAcc.java
new file mode 100644
index 00000000000..56a498e4389
--- /dev/null
+++ b/solr/core/src/java/org/apache/solr/search/facet/UniqueMultivaluedSlotAcc.java
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+package org.apache.solr.search.facet;
+
+import java.io.IOException;
+
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.FixedBitSet;
+import org.apache.solr.search.SolrIndexSearcher;
+
+class UniqueMultivaluedSlotAcc extends UniqueSlotAcc implements UnInvertedField.Callback {
+ private UnInvertedField uif;
+ private UnInvertedField.DocToTerm docToTerm;
+
+ public UniqueMultivaluedSlotAcc(FacetContext fcontext, String field, int numSlots, HLLAgg.HLLFactory factory) throws IOException {
+ super(fcontext, field, numSlots, factory);
+ SolrIndexSearcher searcher = fcontext.qcontext.searcher();
+ uif = UnInvertedField.getUnInvertedField(field, searcher);
+ docToTerm = uif.new DocToTerm();
+ fcontext.qcontext.addCloseHook(this); // TODO: find way to close accumulators instead of using close hook?
+ nTerms = uif.numTerms();
+ }
+
+ @Override
+ protected BytesRef lookupOrd(int ord) throws IOException {
+ return docToTerm.lookupOrd(ord);
+ }
+
+ private FixedBitSet bits; // bits for the current slot, only set for the callback
+
+ @Override
+ public void call(int termNum) {
+ bits.set(termNum);
+ }
+
+ @Override
+ public void collect(int doc, int slotNum) throws IOException {
+ bits = arr[slotNum];
+ if (bits == null) {
+ bits = new FixedBitSet(nTerms);
+ arr[slotNum] = bits;
+ }
+ docToTerm.getBigTerms(doc + currentDocBase, this); // this will call back to our Callback.call(int termNum)
+ docToTerm.getSmallTerms(doc + currentDocBase, this);
+ }
+
+ @Override
+ public void close() throws IOException {
+ if (docToTerm != null) {
+ docToTerm.close();
+ docToTerm = null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/solr/core/src/java/org/apache/solr/search/facet/UniqueSinglevaluedSlotAcc.java b/solr/core/src/java/org/apache/solr/search/facet/UniqueSinglevaluedSlotAcc.java
new file mode 100644
index 00000000000..c67fd47b6f8
--- /dev/null
+++ b/solr/core/src/java/org/apache/solr/search/facet/UniqueSinglevaluedSlotAcc.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+package org.apache.solr.search.facet;
+
+import java.io.IOException;
+
+import org.apache.lucene.index.LeafReaderContext;
+import org.apache.lucene.index.MultiDocValues;
+import org.apache.lucene.index.SortedDocValues;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.FixedBitSet;
+import org.apache.lucene.util.LongValues;
+import org.apache.solr.search.SolrIndexSearcher;
+
+class UniqueSinglevaluedSlotAcc extends UniqueSlotAcc {
+ final SortedDocValues topLevel;
+ final SortedDocValues[] subDvs;
+ final MultiDocValues.OrdinalMap ordMap;
+ LongValues toGlobal;
+ SortedDocValues subDv;
+
+ public UniqueSinglevaluedSlotAcc(FacetContext fcontext, String field, int numSlots, HLLAgg.HLLFactory factory) throws IOException {
+ super(fcontext, field, numSlots, factory);
+ SolrIndexSearcher searcher = fcontext.qcontext.searcher();
+ topLevel = FieldUtil.getSortedDocValues(fcontext.qcontext, searcher.getSchema().getField(field), null);
+ nTerms = topLevel.getValueCount();
+ if (topLevel instanceof MultiDocValues.MultiSortedDocValues) {
+ ordMap = ((MultiDocValues.MultiSortedDocValues)topLevel).mapping;
+ subDvs = ((MultiDocValues.MultiSortedDocValues)topLevel).values;
+ } else {
+ ordMap = null;
+ subDvs = null;
+ }
+ }
+
+ @Override
+ protected BytesRef lookupOrd(int ord) {
+ return topLevel.lookupOrd(ord);
+ }
+
+ @Override
+ public void setNextReader(LeafReaderContext readerContext) throws IOException {
+ super.setNextReader(readerContext);
+ if (subDvs != null) {
+ subDv = subDvs[readerContext.ord];
+ toGlobal = ordMap.getGlobalOrds(readerContext.ord);
+ } else {
+ assert readerContext.ord==0 || topLevel.getValueCount() == 0;
+ subDv = topLevel;
+ }
+ }
+
+ @Override
+ public void collect(int doc, int slotNum) {
+ int segOrd = subDv.getOrd(doc);
+ if (segOrd < 0) return; // -1 means missing
+ int ord = toGlobal==null ? segOrd : (int)toGlobal.get(segOrd);
+
+ FixedBitSet bits = arr[slotNum];
+ if (bits == null) {
+ bits = new FixedBitSet(nTerms);
+ arr[slotNum] = bits;
+ }
+ bits.set(ord);
+ }
+}
\ No newline at end of file
diff --git a/solr/core/src/java/org/apache/solr/search/facet/UniqueSlotAcc.java b/solr/core/src/java/org/apache/solr/search/facet/UniqueSlotAcc.java
index 94532f7e206..9f9e9b1ab95 100644
--- a/solr/core/src/java/org/apache/solr/search/facet/UniqueSlotAcc.java
+++ b/solr/core/src/java/org/apache/solr/search/facet/UniqueSlotAcc.java
@@ -22,17 +22,12 @@ import java.util.List;
import org.apache.solr.util.hll.HLL;
import org.apache.lucene.index.LeafReaderContext;
-import org.apache.lucene.index.MultiDocValues;
-import org.apache.lucene.index.SortedDocValues;
-import org.apache.lucene.index.SortedSetDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.FixedBitSet;
-import org.apache.lucene.util.LongValues;
import org.apache.solr.common.util.Hash;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.schema.SchemaField;
-import org.apache.solr.search.SolrIndexSearcher;
abstract class UniqueSlotAcc extends SlotAcc {
HLLAgg.HLLFactory factory;
@@ -161,164 +156,4 @@ abstract class UniqueSlotAcc extends SlotAcc {
public void resize(Resizer resizer) {
arr = resizer.resize(arr, null);
}
-}
-
-
-class UniqueSinglevaluedSlotAcc extends UniqueSlotAcc {
- final SortedDocValues topLevel;
- final SortedDocValues[] subDvs;
- final MultiDocValues.OrdinalMap ordMap;
- LongValues toGlobal;
- SortedDocValues subDv;
-
- public UniqueSinglevaluedSlotAcc(FacetContext fcontext, String field, int numSlots, HLLAgg.HLLFactory factory) throws IOException {
- super(fcontext, field, numSlots, factory);
- SolrIndexSearcher searcher = fcontext.qcontext.searcher();
- topLevel = FieldUtil.getSortedDocValues(fcontext.qcontext, searcher.getSchema().getField(field), null);
- nTerms = topLevel.getValueCount();
- if (topLevel instanceof MultiDocValues.MultiSortedDocValues) {
- ordMap = ((MultiDocValues.MultiSortedDocValues)topLevel).mapping;
- subDvs = ((MultiDocValues.MultiSortedDocValues)topLevel).values;
- } else {
- ordMap = null;
- subDvs = null;
- }
- }
-
- @Override
- protected BytesRef lookupOrd(int ord) {
- return topLevel.lookupOrd(ord);
- }
-
- @Override
- public void setNextReader(LeafReaderContext readerContext) throws IOException {
- super.setNextReader(readerContext);
- if (subDvs != null) {
- subDv = subDvs[readerContext.ord];
- toGlobal = ordMap.getGlobalOrds(readerContext.ord);
- } else {
- assert readerContext.ord==0 || topLevel.getValueCount() == 0;
- subDv = topLevel;
- }
- }
-
- @Override
- public void collect(int doc, int slotNum) {
- int segOrd = subDv.getOrd(doc);
- if (segOrd < 0) return; // -1 means missing
- int ord = toGlobal==null ? segOrd : (int)toGlobal.get(segOrd);
-
- FixedBitSet bits = arr[slotNum];
- if (bits == null) {
- bits = new FixedBitSet(nTerms);
- arr[slotNum] = bits;
- }
- bits.set(ord);
- }
-}
-
-
-class UniqueMultiDvSlotAcc extends UniqueSlotAcc {
- final SortedSetDocValues topLevel;
- final SortedSetDocValues[] subDvs;
- final MultiDocValues.OrdinalMap ordMap;
- LongValues toGlobal;
- SortedSetDocValues subDv;
-
- public UniqueMultiDvSlotAcc(FacetContext fcontext, String field, int numSlots, HLLAgg.HLLFactory factory) throws IOException {
- super(fcontext, field, numSlots, factory);
- SolrIndexSearcher searcher = fcontext.qcontext.searcher();
- topLevel = FieldUtil.getSortedSetDocValues(fcontext.qcontext, searcher.getSchema().getField(field), null);
- nTerms = (int) topLevel.getValueCount();
- if (topLevel instanceof MultiDocValues.MultiSortedSetDocValues) {
- ordMap = ((MultiDocValues.MultiSortedSetDocValues) topLevel).mapping;
- subDvs = ((MultiDocValues.MultiSortedSetDocValues) topLevel).values;
- } else {
- ordMap = null;
- subDvs = null;
- }
- }
-
- @Override
- protected BytesRef lookupOrd(int ord) {
- return topLevel.lookupOrd(ord);
- }
-
- @Override
- public void setNextReader(LeafReaderContext readerContext) throws IOException {
- super.setNextReader(readerContext);
- if (subDvs != null) {
- subDv = subDvs[readerContext.ord];
- toGlobal = ordMap.getGlobalOrds(readerContext.ord);
- } else {
- assert readerContext.ord==0 || topLevel.getValueCount() == 0;
- subDv = topLevel;
- }
- }
-
- @Override
- public void collect(int doc, int slotNum) {
- subDv.setDocument(doc);
- int segOrd = (int) subDv.nextOrd();
- if (segOrd < 0) return;
-
- FixedBitSet bits = arr[slotNum];
- if (bits == null) {
- bits = new FixedBitSet(nTerms);
- arr[slotNum] = bits;
- }
-
- do {
- int ord = toGlobal == null ? segOrd : (int) toGlobal.get(segOrd);
- bits.set(ord);
- segOrd = (int) subDv.nextOrd();
- } while (segOrd >= 0);
- }
-}
-
-
-
-class UniqueMultivaluedSlotAcc extends UniqueSlotAcc implements UnInvertedField.Callback {
- private UnInvertedField uif;
- private UnInvertedField.DocToTerm docToTerm;
-
- public UniqueMultivaluedSlotAcc(FacetContext fcontext, String field, int numSlots, HLLAgg.HLLFactory factory) throws IOException {
- super(fcontext, field, numSlots, factory);
- SolrIndexSearcher searcher = fcontext.qcontext.searcher();
- uif = UnInvertedField.getUnInvertedField(field, searcher);
- docToTerm = uif.new DocToTerm();
- fcontext.qcontext.addCloseHook(this); // TODO: find way to close accumulators instead of using close hook?
- nTerms = uif.numTerms();
- }
-
- @Override
- protected BytesRef lookupOrd(int ord) throws IOException {
- return docToTerm.lookupOrd(ord);
- }
-
- private FixedBitSet bits; // bits for the current slot, only set for the callback
-
- @Override
- public void call(int termNum) {
- bits.set(termNum);
- }
-
- @Override
- public void collect(int doc, int slotNum) throws IOException {
- bits = arr[slotNum];
- if (bits == null) {
- bits = new FixedBitSet(nTerms);
- arr[slotNum] = bits;
- }
- docToTerm.getBigTerms(doc + currentDocBase, this); // this will call back to our Callback.call(int termNum)
- docToTerm.getSmallTerms(doc + currentDocBase, this);
- }
-
- @Override
- public void close() throws IOException {
- if (docToTerm != null) {
- docToTerm.close();
- docToTerm = null;
- }
- }
}
\ No newline at end of file