You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Uwe Schindler <uw...@thetaphi.de> on 2016/05/16 21:20:58 UTC

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

Hi,

I changed this because the non-inner classes in the same file made huge problems with Eclipse which prevented me from editing the source code at all (it complained about duplicate definitions). In general it is also not good to have those, because it leads to compile failures, because ant and javac cannot correctly track the update dates of the files, because it cannot correlate the class files of the along-the-way classes with the source file (for inner classes it can do this). Those non-inner classes are really Java 1.0 like, since 1.1 they are discouraged, also by OpenJDK.

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?

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: uschindler@apache.org [mailto:uschindler@apache.org]
> Sent: Monday, May 16, 2016 7:54 PM
> To: commits@lucene.apache.org
> 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 <us...@apache.org>
> Authored: Mon May 16 19:54:10 2016 +0200
> Committer: Uwe Schindler <us...@apache.org>
> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


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

Posted by Dawid Weiss <da...@gmail.com>.
> I have no idea, if there is a way to detect those classes via a static tool.

These are not inner classes, Uwe -- they're basically regular classes
that originate from a single source file. And yes, you could try to
detect this by verifying that no two top-level classes have the same
source file in their "SourceFile" attribute (inside the emitted
bytecode). Unless sources are compiled without line numbers/ tracking
info (which isn't a good idea I guess), this should work like a charm.

Just an idea. :)

Dawid

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


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

Posted by Ryan Josal <rj...@gmail.com>.
Uwe, I agree keeping pkg private is the simplest and safest approach, and
yes a static inner class would solve the problem of JSONWriter, though for
consistency's sake, JSONWriter feels like it should become a top level
public class like it's counterpart XMLWriter.

Ryan

On Monday, May 16, 2016, Uwe Schindler <uw...@thetaphi.de> wrote:

> Hi,
>
>
>
> I think there was an issue open about that years ago, but I did not catch
> all of those when fixing it. And the facet ones are new.
>
>
>
> When I have time, I will look into refactoring those classes, but there
> are 2 possibilities:
>
>
>
> -          Move them as static inner classes. This allows to make them
> public or otherwise visible (I think that is Ryan Josal’s problem).
>
> -          Just keep them pkg-private and move them to separate files.
> That’s easier and faster to do. This is what I have done because of the
> Eclipse problem.
>
>
>
> I prefer the second one, as it keeps API the same and does not change
> anything.
>
>
>
> I have no idea, if there is a way to detect those classes via a static
> tool.
>
>
>
> Uwe
>
>
>
> -----
>
> Uwe Schindler
>
> H.-H.-Meier-Allee 63, D-28213 Bremen
>
> http://www.thetaphi.de
>
> eMail: uwe@thetaphi.de <javascript:_e(%7B%7D,'cvml','uwe@thetaphi.de');>
>
>
>
> *From:* rjosal@gmail.com
> <javascript:_e(%7B%7D,'cvml','rjosal@gmail.com');> [mailto:
> rjosal@gmail.com <javascript:_e(%7B%7D,'cvml','rjosal@gmail.com');>] *On
> Behalf Of *Ryan Josal
> *Sent:* Monday, May 16, 2016 11:43 PM
> *To:* dev@lucene.apache.org
> <javascript:_e(%7B%7D,'cvml','dev@lucene.apache.org');>
> *Subject:* Re: lucene-solr:master: Move non-inner classes to separate
> files: This breaks IDEs and update checks by javac
>
>
>
> +1 it's a pain for plugin development too.  Extending JSONResponseWriter
> comes to mind.
>
> On Monday, May 16, 2016, Chris Hostetter <hossman_lucene@fucit.org
> <javascript:_e(%7B%7D,'cvml','hossman_lucene@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: uwe@thetaphi.de
> :
> : > -----Original Message-----
> : > From: uschindler@apache.org [mailto:uschindler@apache.org]
> : > Sent: Monday, May 16, 2016 7:54 PM
> : > To: commits@lucene.apache.org
> : > 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 <us...@apache.org>
> : > Authored: Mon May 16 19:54:10 2016 +0200
> : > Committer: Uwe Schindler <us...@apache.org>
> : > 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-unsubscribe@lucene.apache.org
> : For additional commands, e-mail: dev-help@lucene.apache.org
> :
> :
>
> -Hoss
> http://www.lucidworks.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

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

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,

 

I think there was an issue open about that years ago, but I did not catch all of those when fixing it. And the facet ones are new.

 

When I have time, I will look into refactoring those classes, but there are 2 possibilities:

 

-          Move them as static inner classes. This allows to make them public or otherwise visible (I think that is Ryan Josal’s problem).

-          Just keep them pkg-private and move them to separate files. That’s easier and faster to do. This is what I have done because of the Eclipse problem.

 

I prefer the second one, as it keeps API the same and does not change anything.

 

I have no idea, if there is a way to detect those classes via a static tool.

 

Uwe

 

-----

Uwe Schindler

H.-H.-Meier-Allee 63, D-28213 Bremen

 <http://www.thetaphi.de/> http://www.thetaphi.de

eMail: uwe@thetaphi.de

 

From: rjosal@gmail.com [mailto:rjosal@gmail.com] On Behalf Of Ryan Josal
Sent: Monday, May 16, 2016 11:43 PM
To: dev@lucene.apache.org
Subject: Re: lucene-solr:master: Move non-inner classes to separate files: This breaks IDEs and update checks by javac

 

+1 it's a pain for plugin development too.  Extending JSONResponseWriter comes to mind.

On Monday, May 16, 2016, Chris Hostetter <hossman_lucene@fucit.org <ma...@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: uwe@thetaphi.de <javascript:;> 
:
: > -----Original Message-----
: > From: uschindler@apache.org <javascript:;>  [mailto:uschindler@apache.org <javascript:;> ]
: > Sent: Monday, May 16, 2016 7:54 PM
: > To: commits@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 <uschindler@apache.org <javascript:;> >
: > Authored: Mon May 16 19:54:10 2016 +0200
: > Committer: Uwe Schindler <uschindler@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-unsubscribe@lucene.apache.org <javascript:;> 
: For additional commands, e-mail: dev-help@lucene.apache.org <javascript:;> 
:
:

-Hoss
http://www.lucidworks.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org <javascript:;> 
For additional commands, e-mail: dev-help@lucene.apache.org <javascript:;> 


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

Posted by Ryan Josal <ry...@josal.com>.
+1 it's a pain for plugin development too.  Extending JSONResponseWriter
comes to mind.

On Monday, May 16, 2016, Chris Hostetter <ho...@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: uwe@thetaphi.de <javascript:;>
> :
> : > -----Original Message-----
> : > From: uschindler@apache.org <javascript:;> [mailto:
> uschindler@apache.org <javascript:;>]
> : > Sent: Monday, May 16, 2016 7:54 PM
> : > To: commits@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 <uschindler@apache.org <javascript:;>>
> : > Authored: Mon May 16 19:54:10 2016 +0200
> : > Committer: Uwe Schindler <uschindler@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-unsubscribe@lucene.apache.org <javascript:;>
> : For additional commands, e-mail: dev-help@lucene.apache.org
> <javascript:;>
> :
> :
>
> -Hoss
> http://www.lucidworks.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org <javascript:;>
> For additional commands, e-mail: dev-help@lucene.apache.org <javascript:;>
>
>

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

Posted by Chris Hostetter <ho...@fucit.org>.
: 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: uwe@thetaphi.de
: 
: > -----Original Message-----
: > From: uschindler@apache.org [mailto:uschindler@apache.org]
: > Sent: Monday, May 16, 2016 7:54 PM
: > To: commits@lucene.apache.org
: > 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 <us...@apache.org>
: > Authored: Mon May 16 19:54:10 2016 +0200
: > Committer: Uwe Schindler <us...@apache.org>
: > 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-unsubscribe@lucene.apache.org
: For additional commands, e-mail: dev-help@lucene.apache.org
: 
: 

-Hoss
http://www.lucidworks.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


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

Posted by Yonik Seeley <ys...@gmail.com>.
On Mon, May 16, 2016 at 5:20 PM, Uwe Schindler <uw...@thetaphi.de> 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?

I have a large patch in progress against these files, so I'd
appreciate them not being moved around yet.
I can do the move after that patch is in.

I've never had a problem with intellij with regard to these files...
it's too bad it seems to cause such problems in eclipse.

-Yonik

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org