Apache Lucene open-source search software
LUCENE-5666: clear nocommits and fix precommit
Robert Muir2078b86ba72b
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 9558534ee33..d5f0e42d32f 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -65,6 +65,18 @@ API Changesas tokens anymore, and now iterates cells on-demand during indexing instead ofbuilding a collection. RPT now has more setters. (David Smiley)+* LUCENE-5666: Change uninverted access (sorting, faceting, grouping, etc)+ to use the DocValues API instead of FieldCache. For FieldCache functionality,+ use UninvertingReader in lucene/misc (or implement your own FilterReader).+ UninvertingReader is more efficient: supports multi-valued numeric fields,+ detects when a multi-valued field is single-valued, reuses caches+ of compatible types (e.g. SORTED also supports BINARY and SORTED_SET access+ without insanity). "Insanity" is no longer possible unless you explicitly want it.+ Rename FieldCache* and DocTermOrds* classes in the search package to DocValues*.+ Move SortedSetSortField to core and add SortedSetFieldSource to queries/, which+ takes the same selectors. Add helper methods to DocValues.java that are better+ suited for search code (never return null, etc). (Mike McCandless, Robert Muir)+Documentation* LUCENE-5392: Add/improve analysis package documentation to reflectdiff --git a/lucene/analysis/common/src/test/org/apache/lucene/collation/TestCollationDocValuesField.java b/lucene/analysis/common/src/test/org/apache/lucene/collation/TestCollationDocValuesField.javaindex 2e4a24276de..054f64b6c94 100644--- a/lucene/analysis/common/src/test/org/apache/lucene/collation/TestCollationDocValuesField.java+++ b/lucene/analysis/common/src/test/org/apache/lucene/collation/TestCollationDocValuesField.java@@ -85,7 +85,7 @@ public class TestCollationDocValuesField extends LuceneTestCase {RandomIndexWriter iw = new RandomIndexWriter(random(), dir);Document doc = new Document();Field field = newField("field", "", StringField.TYPE_STORED);- Collator collator = Collator.getInstance(); // uses -Dtests.locale+ Collator collator = Collator.getInstance(Locale.getDefault()); // uses -Dtests.localeif (random().nextBoolean()) {collator.setStrength(Collator.PRIMARY);}diff --git a/lucene/core/build.xml b/lucene/core/build.xmlindex 8b7d018fff6..7d80c70662c 100644--- a/lucene/core/build.xml+++ b/lucene/core/build.xml@@ -31,7 +31,6 @@"/><property name="forbidden-rue-excludes" value="- org/apache/lucene/search/FieldCache$CacheEntry.classorg/apache/lucene/util/RamUsageEstimator.classorg/apache/lucene/search/CachingWrapperFilter.class"/>diff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/BlockGroupingCollector.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/BlockGroupingCollector.javaindex 7c33583292f..f40c2a756b8 100644--- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/BlockGroupingCollector.java+++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/BlockGroupingCollector.java@@ -300,7 +300,7 @@ public class BlockGroupingCollector extends SimpleCollector {* This is normally not a problem, as you can obtain the* value just like you obtain other values for each* matching document (eg, via stored fields, via- * FieldCache, etc.)+ * DocValues, etc.)** @param withinGroupSort The {@link Sort} used to sort* documents within each group. Passing null isdiff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/package.html b/lucene/grouping/src/java/org/apache/lucene/search/grouping/package.htmlindex e45b66692be..c346c717c7d 100644--- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/package.html+++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/package.html@@ -80,8 +80,7 @@ field fall into a single group.</p><p>Known limitations:</p><ul><li> For the two-pass grouping search, the group field must be a- single-valued indexed field (or indexed as a {@link org.apache.lucene.document.SortedDocValuesField}).- {@link org.apache.lucene.search.FieldCache} is used to load the {@link org.apache.lucene.index.SortedDocValues} for this field.+ indexed as a {@link org.apache.lucene.document.SortedDocValuesField}).<li> Although Solr support grouping by function and this module has abstraction of what a group is, there are currently onlyimplementations for grouping based on terms.<li> Sharding is not directly supported, though is not toodiff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/TermFirstPassGroupingCollector.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/TermFirstPassGroupingCollector.javaindex 92230b3822e..9e5efa37c38 100644--- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/TermFirstPassGroupingCollector.java+++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/TermFirstPassGroupingCollector.java@@ -46,7 +46,7 @@ public class TermFirstPassGroupingCollector extends AbstractFirstPassGroupingCol** @param groupField The field used to group* documents. This field must be single-valued and- * indexed (FieldCache is used to access its value+ * indexed (DocValues is used to access its value* per-document).* @param groupSort The {@link Sort} used to sort the* groups. The top sorted document within each groupdiff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/package.html b/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/package.htmlindex 6a1c9f5ba87..29b44c5a6bc 100644--- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/package.html+++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/package.html@@ -16,6 +16,6 @@--><html><body>-Support for grouping by indexed terms via {@link org.apache.lucene.search.FieldCache}.+Support for grouping by indexed terms via {@link org.apache.lucene.index.DocValues}.</body></html>diff --git a/lucene/misc/build.xml b/lucene/misc/build.xmlindex b5ee7b2a5f4..2dad71eda46 100644--- a/lucene/misc/build.xml+++ b/lucene/misc/build.xml@@ -32,6 +32,10 @@org/apache/lucene/misc/IndexMergeTool.class"/>+ <property name="forbidden-rue-excludes" value="+ org/apache/lucene/uninverting/FieldCache$CacheEntry.class+ "/>+<import file="../module-build.xml"/><target name="install-cpptasks" unless="cpptasks.uptodate" depends="ivy-availability-check,ivy-fail,ivy-configure">diff --git a/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java b/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.javaindex 08cd9c8e2f4..7f5b6739492 100644--- a/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java+++ b/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java@@ -40,6 +40,7 @@ import org.apache.lucene.index.FilterDirectoryReader;import org.apache.lucene.index.NumericDocValues;import org.apache.lucene.index.SortedDocValues;import org.apache.lucene.index.SortedSetDocValues;+import org.apache.lucene.uninverting.FieldCache.CacheEntry;import org.apache.lucene.util.Bits;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.NumericUtils;@@ -309,4 +310,17 @@ public class UninvertingReader extends FilterAtomicReader {public String toString() {return "Uninverting(" + in.toString() + ")";}++ /**+ * Return information about the backing cache+ * @lucene.internal+ */+ public static String[] getUninvertedStats() {+ CacheEntry[] entries = FieldCache.DEFAULT.getCacheEntries();+ String[] info = new String[entries.length];+ for (int i = 0; i < entries.length; i++) {+ info[i] = entries[i].toString();+ }+ return info;+ }}diff --git a/solr/core/src/java/org/apache/solr/search/SolrFieldCacheMBean.java b/solr/core/src/java/org/apache/solr/search/SolrFieldCacheMBean.javaindex 1815800656a..76551b0548d 100644--- a/solr/core/src/java/org/apache/solr/search/SolrFieldCacheMBean.java+++ b/solr/core/src/java/org/apache/solr/search/SolrFieldCacheMBean.java@@ -19,28 +19,19 @@ package org.apache.solr.search;import java.net.URL;+import org.apache.lucene.uninverting.UninvertingReader;import org.apache.solr.common.util.NamedList;import org.apache.solr.common.util.SimpleOrderedMap;import org.apache.solr.core.SolrCore;import org.apache.solr.core.SolrInfoMBean;-/*-import org.apache.lucene.search.FieldCache;-import org.apache.lucene.search.FieldCache.CacheEntry;-import org.apache.lucene.util.FieldCacheSanityChecker;-import org.apache.lucene.util.FieldCacheSanityChecker.Insanity;-*/-// nocommit: maybe provide something useful here instead.-/*** A SolrInfoMBean that provides introspection of the Solr FieldCache**/public class SolrFieldCacheMBean implements SolrInfoMBean {- //protected FieldCacheSanityChecker checker = new FieldCacheSanityChecker();-@Overridepublic String getName() { return this.getClass().getName(); }@Override@@ -62,21 +53,11 @@ public class SolrFieldCacheMBean implements SolrInfoMBean {@Overridepublic NamedList getStatistics() {NamedList stats = new SimpleOrderedMap();- /*- CacheEntry[] entries = FieldCache.DEFAULT.getCacheEntries();+ String[] entries = UninvertingReader.getUninvertedStats();stats.add("entries_count", entries.length);for (int i = 0; i < entries.length; i++) {- CacheEntry e = entries[i];- stats.add("entry#" + i, e.toString());+ stats.add("entry#" + i, entries[i]);}-- Insanity[] insanity = checker.check(entries);-- stats.add("insanity_count", insanity.length);- for (int i = 0; i < insanity.length; i++) {-- stats.add("insanity#" + i, insanity[i].toString());- }*/return stats;}diff --git a/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java b/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.javaindex b1bf15954f5..2ad29edf650 100644--- a/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java+++ b/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java@@ -417,10 +417,6 @@ public class TestFunctionQuery extends SolrTestCaseJ4 {,"*//doc[1]/float[.='120.0']","*//doc[2]/float[.='121.0']");--- // nocommit: split test if needed- // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity}/**