+1 it's a pain for plugin development too. Extending JSONResponseWriter comes to mind.
On Monday, May 16, 2016, Chris Hostetter <hossman_luc...@fucit.org> wrote: > > : I found out that there are more of those in the facets module. Can we > : change those to be real *inner* classes or put them in separate files? > > +1 ... it's a really obnoxiou missfeature of java in my opinion ... are > there any static tools we can enable to fail the build for classes like > these? > > > > : ----- > : Uwe Schindler > : H.-H.-Meier-Allee 63, D-28213 Bremen > : http://www.thetaphi.de > : eMail: u...@thetaphi.de <javascript:;> > : > : > -----Original Message----- > : > From: uschind...@apache.org <javascript:;> [mailto: > uschind...@apache.org <javascript:;>] > : > Sent: Monday, May 16, 2016 7:54 PM > : > To: comm...@lucene.apache.org <javascript:;> > : > Subject: lucene-solr:master: Move non-inner classes to separate files: > This > : > breaks IDEs and update checks by javac > : > > : > Repository: lucene-solr > : > Updated Branches: > : > refs/heads/master 6620fd142 -> ae93f4e7a > : > > : > > : > Move non-inner classes to separate files: This breaks IDEs and update > checks > : > by javac > : > > : > > : > Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo > : > Commit: http://git-wip-us.apache.org/repos/asf/lucene- > : > solr/commit/ae93f4e7 > : > Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ae93f4e7 > : > Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ae93f4e7 > : > > : > Branch: refs/heads/master > : > Commit: ae93f4e7ac6a3908046391de35d4f50a0d3c59ca > : > Parents: 6620fd1 > : > Author: Uwe Schindler <uschind...@apache.org <javascript:;>> > : > Authored: Mon May 16 19:54:10 2016 +0200 > : > Committer: Uwe Schindler <uschind...@apache.org <javascript:;>> > : > Committed: Mon May 16 19:54:10 2016 +0200 > : > > : > ---------------------------------------------------------------------- > : > .../solr/search/facet/UniqueMultiDvSlotAcc.java | 86 ++++++++++ > : > .../search/facet/UniqueMultivaluedSlotAcc.java | 69 ++++++++ > : > .../search/facet/UniqueSinglevaluedSlotAcc.java | 81 +++++++++ > : > .../apache/solr/search/facet/UniqueSlotAcc.java | 165 > ------------------- > : > 4 files changed, 236 insertions(+), 165 deletions(-) > : > ---------------------------------------------------------------------- > : > > : > > : > http://git-wip-us.apache.org/repos/asf/lucene- > : > > solr/blob/ae93f4e7/solr/core/src/java/org/apache/solr/search/facet/Unique > : > MultiDvSlotAcc.java > : > ---------------------------------------------------------------------- > : > diff --git > : > > a/solr/core/src/java/org/apache/solr/search/facet/UniqueMultiDvSlotAcc.ja > : > va > : > > b/solr/core/src/java/org/apache/solr/search/facet/UniqueMultiDvSlotAcc.ja > : > va > : > new file mode 100644 > : > index 0000000..4c29753 > : > --- /dev/null > : > +++ > : > > b/solr/core/src/java/org/apache/solr/search/facet/UniqueMultiDvSlotAcc.ja > : > va > : > @@ -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 > : > > : > http://git-wip-us.apache.org/repos/asf/lucene- > : > > solr/blob/ae93f4e7/solr/core/src/java/org/apache/solr/search/facet/Unique > : > MultivaluedSlotAcc.java > : > ---------------------------------------------------------------------- > : > diff --git > : > > a/solr/core/src/java/org/apache/solr/search/facet/UniqueMultivaluedSlotA > : > cc.java > : > > b/solr/core/src/java/org/apache/solr/search/facet/UniqueMultivaluedSlotA > : > cc.java > : > new file mode 100644 > : > index 0000000..56a498e > : > --- /dev/null > : > +++ > : > > b/solr/core/src/java/org/apache/solr/search/facet/UniqueMultivaluedSlotA > : > cc.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 > : > > : > http://git-wip-us.apache.org/repos/asf/lucene- > : > > solr/blob/ae93f4e7/solr/core/src/java/org/apache/solr/search/facet/Unique > : > SinglevaluedSlotAcc.java > : > ---------------------------------------------------------------------- > : > diff --git > : > > a/solr/core/src/java/org/apache/solr/search/facet/UniqueSinglevaluedSlotA > : > cc.java > : > > b/solr/core/src/java/org/apache/solr/search/facet/UniqueSinglevaluedSlotA > : > cc.java > : > new file mode 100644 > : > index 0000000..c67fd47 > : > --- /dev/null > : > +++ > : > > b/solr/core/src/java/org/apache/solr/search/facet/UniqueSinglevaluedSlotA > : > cc.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 > : > > : > http://git-wip-us.apache.org/repos/asf/lucene- > : > > solr/blob/ae93f4e7/solr/core/src/java/org/apache/solr/search/facet/Unique > : > SlotAcc.java > : > ---------------------------------------------------------------------- > : > 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 94532f7..9f9e9b1 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 > : > : > : --------------------------------------------------------------------- > : To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org <javascript:;> > : For additional commands, e-mail: dev-h...@lucene.apache.org > <javascript:;> > : > : > > -Hoss > http://www.lucidworks.com/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org <javascript:;> > For additional commands, e-mail: dev-h...@lucene.apache.org <javascript:;> > >