From 9714faa3141d871a1a1699763faa978b06830445 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Sun, 11 May 2014 20:38:21 +0000 Subject: [PATCH] LUCENE-5666: get solr compiling git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5666@1593856 13f79535-47bb-0310-9956-ffa450edef68 --- .../StatsCollectorSupplierFactory.java | 9 ++++--- .../solr/analytics/util/AnalyticsParsers.java | 4 ---- .../util/valuesource/DateFieldSource.java | 24 +++++++------------ .../handler/component/ExpandComponent.java | 4 ++-- .../handler/component/FieldFacetStats.java | 4 ++-- .../apache/solr/request/NumericFacets.java | 12 +++++----- .../PerSegmentSingleValuedFaceting.java | 4 ++-- .../org/apache/solr/request/SimpleFacets.java | 4 ++-- .../apache/solr/request/UnInvertedField.java | 2 +- .../org/apache/solr/schema/BoolField.java | 4 ++-- .../org/apache/solr/schema/EnumField.java | 4 ++-- .../org/apache/solr/schema/TrieField.java | 23 +++++++++--------- .../solr/search/CollapsingQParserPlugin.java | 14 ++++------- .../solr/search/SolrFieldCacheMBean.java | 21 +++++++--------- .../apache/solr/TestDistributedSearch.java | 4 ++-- .../org/apache/solr/TestGroupingSearch.java | 4 ++-- .../org/apache/solr/TestRandomDVFaceting.java | 4 ++-- .../org/apache/solr/TestRandomFaceting.java | 4 ++-- .../org/apache/solr/request/TestFaceting.java | 2 +- .../search/function/TestFunctionQuery.java | 16 ++++++++----- .../solr/BaseDistributedSearchTestCase.java | 4 ++-- 21 files changed, 76 insertions(+), 95 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/analytics/statistics/StatsCollectorSupplierFactory.java b/solr/core/src/java/org/apache/solr/analytics/statistics/StatsCollectorSupplierFactory.java index ab9966b4fa5..35b5d582c50 100644 --- a/solr/core/src/java/org/apache/solr/analytics/statistics/StatsCollectorSupplierFactory.java +++ b/solr/core/src/java/org/apache/solr/analytics/statistics/StatsCollectorSupplierFactory.java @@ -33,7 +33,6 @@ import org.apache.lucene.queries.function.valuesource.DoubleFieldSource; import org.apache.lucene.queries.function.valuesource.FloatFieldSource; import org.apache.lucene.queries.function.valuesource.IntFieldSource; import org.apache.lucene.queries.function.valuesource.LongFieldSource; -import org.apache.lucene.search.FieldCache; import org.apache.solr.analytics.expression.ExpressionFactory; import org.apache.solr.analytics.request.ExpressionRequest; import org.apache.solr.analytics.util.AnalyticsParams; @@ -357,7 +356,7 @@ public class StatsCollectorSupplierFactory { if (sourceType!=NUMBER_TYPE&&sourceType!=FIELD_TYPE) { return null; } - return new IntFieldSource(expressionString, FieldCache.NUMERIC_UTILS_INT_PARSER) { + return new IntFieldSource(expressionString) { public String description() { return field; } @@ -366,7 +365,7 @@ public class StatsCollectorSupplierFactory { if (sourceType!=NUMBER_TYPE&&sourceType!=FIELD_TYPE) { return null; } - return new LongFieldSource(expressionString, FieldCache.NUMERIC_UTILS_LONG_PARSER) { + return new LongFieldSource(expressionString) { public String description() { return field; } @@ -375,7 +374,7 @@ public class StatsCollectorSupplierFactory { if (sourceType!=NUMBER_TYPE&&sourceType!=FIELD_TYPE) { return null; } - return new FloatFieldSource(expressionString, FieldCache.NUMERIC_UTILS_FLOAT_PARSER) { + return new FloatFieldSource(expressionString) { public String description() { return field; } @@ -384,7 +383,7 @@ public class StatsCollectorSupplierFactory { if (sourceType!=NUMBER_TYPE&&sourceType!=FIELD_TYPE) { return null; } - return new DoubleFieldSource(expressionString, FieldCache.NUMERIC_UTILS_DOUBLE_PARSER) { + return new DoubleFieldSource(expressionString) { public String description() { return field; } diff --git a/solr/core/src/java/org/apache/solr/analytics/util/AnalyticsParsers.java b/solr/core/src/java/org/apache/solr/analytics/util/AnalyticsParsers.java index 98607e1f696..0e4ecebe439 100644 --- a/solr/core/src/java/org/apache/solr/analytics/util/AnalyticsParsers.java +++ b/solr/core/src/java/org/apache/solr/analytics/util/AnalyticsParsers.java @@ -18,13 +18,9 @@ package org.apache.solr.analytics.util; import java.io.IOException; -import java.text.ParseException; import java.util.Arrays; import java.util.Date; -import org.apache.lucene.index.Terms; -import org.apache.lucene.index.TermsEnum; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.NumericUtils; import org.apache.solr.schema.FieldType; diff --git a/solr/core/src/java/org/apache/solr/analytics/util/valuesource/DateFieldSource.java b/solr/core/src/java/org/apache/solr/analytics/util/valuesource/DateFieldSource.java index 7366d2c9653..c002e35cd4a 100644 --- a/solr/core/src/java/org/apache/solr/analytics/util/valuesource/DateFieldSource.java +++ b/solr/core/src/java/org/apache/solr/analytics/util/valuesource/DateFieldSource.java @@ -18,18 +18,18 @@ package org.apache.solr.analytics.util.valuesource; import java.io.IOException; -import java.text.ParseException; import java.util.Date; import java.util.Map; import org.apache.lucene.index.AtomicReaderContext; +import org.apache.lucene.index.DocValues; import org.apache.lucene.index.NumericDocValues; import org.apache.lucene.queries.function.FunctionValues; import org.apache.lucene.queries.function.docvalues.LongDocValues; import org.apache.lucene.queries.function.valuesource.LongFieldSource; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.util.Bits; import org.apache.lucene.util.BytesRef; +import org.apache.lucene.util.NumericUtils; import org.apache.lucene.util.mutable.MutableValue; import org.apache.lucene.util.mutable.MutableValueDate; import org.apache.solr.schema.TrieDateField; @@ -41,15 +41,11 @@ import org.apache.solr.schema.TrieDateField; public class DateFieldSource extends LongFieldSource { public DateFieldSource(String field) { - super(field, FieldCache.NUMERIC_UTILS_LONG_PARSER); - } - - public DateFieldSource(String field, FieldCache.Parser parser) { - super(field, parser); + super(field); } public long externalToLong(String extVal) { - return parser.parseValue(new BytesRef(extVal)); + return NumericUtils.prefixCodedToLong(new BytesRef(extVal)); } public Object longToObject(long val) { @@ -63,8 +59,8 @@ public class DateFieldSource extends LongFieldSource { @Override public FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { - final NumericDocValues arr = cache.getNumerics(readerContext.reader(), field, parser, true); - final Bits valid = cache.getDocsWithField(readerContext.reader(), field); + final NumericDocValues arr = DocValues.getNumeric(readerContext.reader(), field); + final Bits valid = DocValues.getDocsWithField(readerContext.reader(), field); return new LongDocValues(this) { @Override public long longVal(int doc) { @@ -111,16 +107,12 @@ public class DateFieldSource extends LongFieldSource { public boolean equals(Object o) { if (o.getClass() != this.getClass()) return false; DateFieldSource other = (DateFieldSource) o; - if (parser==null) { - return field.equals(other.field); - } else { - return field.equals(other.field) && parser.equals(other.parser); - } + return field.equals(other.field); } @Override public int hashCode() { - int h = parser == null ? this.getClass().hashCode() : parser.getClass().hashCode(); + int h = this.getClass().hashCode(); h += super.hashCode(); return h; } diff --git a/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java b/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java index 64b5690b69e..a8d9a7d2412 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java +++ b/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java @@ -19,6 +19,7 @@ package org.apache.solr.handler.component; import org.apache.lucene.index.AtomicReader; import org.apache.lucene.index.AtomicReaderContext; +import org.apache.lucene.index.DocValues; import org.apache.lucene.index.SortedDocValues; import org.apache.lucene.search.LeafCollector; import org.apache.lucene.search.DocIdSetIterator; @@ -27,7 +28,6 @@ import org.apache.lucene.search.Scorer; import org.apache.lucene.search.SimpleCollector; import org.apache.lucene.search.Sort; import org.apache.lucene.search.TopDocs; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.Query; import org.apache.lucene.search.Collector; import org.apache.lucene.search.TopDocsCollector; @@ -188,7 +188,7 @@ public class ExpandComponent extends SearchComponent implements PluginInfoInitia SolrIndexSearcher searcher = req.getSearcher(); AtomicReader reader = searcher.getAtomicReader(); - SortedDocValues values = FieldCache.DEFAULT.getTermsIndex(reader, field); + SortedDocValues values = DocValues.getSorted(reader, field); FixedBitSet groupBits = new FixedBitSet(values.getValueCount()); DocList docList = rb.getResults().docList; IntOpenHashSet collapsedSet = new IntOpenHashSet(docList.size()*2); diff --git a/solr/core/src/java/org/apache/solr/handler/component/FieldFacetStats.java b/solr/core/src/java/org/apache/solr/handler/component/FieldFacetStats.java index 70d0f382082..28020bc5c07 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/FieldFacetStats.java +++ b/solr/core/src/java/org/apache/solr/handler/component/FieldFacetStats.java @@ -25,10 +25,10 @@ import java.util.Map; import org.apache.lucene.index.AtomicReader; import org.apache.lucene.index.AtomicReaderContext; +import org.apache.lucene.index.DocValues; import org.apache.lucene.index.SortedDocValues; import org.apache.lucene.queries.function.FunctionValues; import org.apache.lucene.queries.function.ValueSource; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.util.BytesRef; import org.apache.solr.schema.SchemaField; import org.apache.solr.search.SolrIndexSearcher; @@ -100,7 +100,7 @@ public class FieldFacetStats { // Currently only used by UnInvertedField stats public boolean facetTermNum(int docID, int statsTermNum) throws IOException { if (topLevelSortedValues == null) { - topLevelSortedValues = FieldCache.DEFAULT.getTermsIndex(topLevelReader, name); + topLevelSortedValues = DocValues.getSorted(topLevelReader, name); } int term = topLevelSortedValues.getOrd(docID); diff --git a/solr/core/src/java/org/apache/solr/request/NumericFacets.java b/solr/core/src/java/org/apache/solr/request/NumericFacets.java index 28e29fa5ff2..2f2dd7d2a85 100644 --- a/solr/core/src/java/org/apache/solr/request/NumericFacets.java +++ b/solr/core/src/java/org/apache/solr/request/NumericFacets.java @@ -30,13 +30,13 @@ import java.util.Set; import org.apache.lucene.document.FieldType.NumericType; import org.apache.lucene.index.AtomicReaderContext; +import org.apache.lucene.index.DocValues; import org.apache.lucene.index.NumericDocValues; import org.apache.lucene.index.ReaderUtil; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.queries.function.FunctionValues; import org.apache.lucene.queries.function.ValueSource; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.util.Bits; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.CharsRef; @@ -156,13 +156,13 @@ final class NumericFacets { assert doc >= ctx.docBase; switch (numericType) { case LONG: - longs = FieldCache.DEFAULT.getNumerics(ctx.reader(), fieldName, FieldCache.NUMERIC_UTILS_LONG_PARSER, true); + longs = DocValues.getNumeric(ctx.reader(), fieldName); break; case INT: - longs = FieldCache.DEFAULT.getNumerics(ctx.reader(), fieldName, FieldCache.NUMERIC_UTILS_INT_PARSER, true); + longs = DocValues.getNumeric(ctx.reader(), fieldName); break; case FLOAT: - final NumericDocValues floats = FieldCache.DEFAULT.getNumerics(ctx.reader(), fieldName, FieldCache.NUMERIC_UTILS_FLOAT_PARSER, true); + final NumericDocValues floats = DocValues.getNumeric(ctx.reader(), fieldName); // TODO: this bit flipping should probably be moved to tie-break in the PQ comparator longs = new NumericDocValues() { @Override @@ -174,7 +174,7 @@ final class NumericFacets { }; break; case DOUBLE: - final NumericDocValues doubles = FieldCache.DEFAULT.getNumerics(ctx.reader(), fieldName, FieldCache.NUMERIC_UTILS_DOUBLE_PARSER, true); + final NumericDocValues doubles = DocValues.getNumeric(ctx.reader(), fieldName); // TODO: this bit flipping should probably be moved to tie-break in the PQ comparator longs = new NumericDocValues() { @Override @@ -188,7 +188,7 @@ final class NumericFacets { default: throw new AssertionError(); } - docsWithField = FieldCache.DEFAULT.getDocsWithField(ctx.reader(), fieldName); + docsWithField = DocValues.getDocsWithField(ctx.reader(), fieldName); } long v = longs.get(doc - ctx.docBase); if (v != 0 || docsWithField.get(doc - ctx.docBase)) { diff --git a/solr/core/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java b/solr/core/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java index 6ad399c514a..5caf34baabb 100644 --- a/solr/core/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java +++ b/solr/core/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java @@ -22,11 +22,11 @@ import java.util.*; import java.util.concurrent.*; import org.apache.lucene.index.AtomicReaderContext; +import org.apache.lucene.index.DocValues; import org.apache.lucene.index.SortedDocValues; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSetIterator; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.Filter; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.CharsRef; @@ -236,7 +236,7 @@ class PerSegmentSingleValuedFaceting { BytesRef tempBR = new BytesRef(); void countTerms() throws IOException { - si = FieldCache.DEFAULT.getTermsIndex(context.reader(), fieldName); + si = DocValues.getSorted(context.reader(), fieldName); // SolrCore.log.info("reader= " + reader + " FC=" + System.identityHashCode(si)); if (prefix!=null) { diff --git a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java index 38aeb0ca493..6c1bbed5729 100644 --- a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java +++ b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java @@ -38,6 +38,7 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.apache.lucene.index.AtomicReader; +import org.apache.lucene.index.DocValues; import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.Fields; import org.apache.lucene.index.MultiDocsEnum; @@ -46,7 +47,6 @@ import org.apache.lucene.index.Term; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.search.DocIdSetIterator; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.Filter; import org.apache.lucene.search.MatchAllDocsQuery; import org.apache.lucene.search.Query; @@ -644,7 +644,7 @@ public class SimpleFacets { FieldType ft = searcher.getSchema().getFieldType(fieldName); NamedList res = new NamedList<>(); - SortedDocValues si = FieldCache.DEFAULT.getTermsIndex(searcher.getAtomicReader(), fieldName); + SortedDocValues si = DocValues.getSorted(searcher.getAtomicReader(), fieldName); final BytesRef br = new BytesRef(); diff --git a/solr/core/src/java/org/apache/solr/request/UnInvertedField.java b/solr/core/src/java/org/apache/solr/request/UnInvertedField.java index 4e591bac78d..9ab7d84a18d 100644 --- a/solr/core/src/java/org/apache/solr/request/UnInvertedField.java +++ b/solr/core/src/java/org/apache/solr/request/UnInvertedField.java @@ -23,12 +23,12 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import org.apache.lucene.index.AtomicReader; -import org.apache.lucene.index.DocTermOrds; import org.apache.lucene.index.SortedDocValues; import org.apache.lucene.index.Term; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.TermRangeQuery; +import org.apache.lucene.uninverting.DocTermOrds; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.CharsRef; import org.apache.lucene.util.FixedBitSet; diff --git a/solr/core/src/java/org/apache/solr/schema/BoolField.java b/solr/core/src/java/org/apache/solr/schema/BoolField.java index c6376cb428b..4c0f84a0927 100644 --- a/solr/core/src/java/org/apache/solr/schema/BoolField.java +++ b/solr/core/src/java/org/apache/solr/schema/BoolField.java @@ -25,6 +25,7 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.index.AtomicReaderContext; +import org.apache.lucene.index.DocValues; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.SortedDocValues; import org.apache.lucene.index.StorableField; @@ -32,7 +33,6 @@ import org.apache.lucene.queries.function.FunctionValues; import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.queries.function.docvalues.BoolDocValues; import org.apache.lucene.queries.function.valuesource.OrdFieldSource; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.SortField; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.CharsRef; @@ -179,7 +179,7 @@ class BoolFieldSource extends ValueSource { @Override public FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws IOException { - final SortedDocValues sindex = FieldCache.DEFAULT.getTermsIndex(readerContext.reader(), field); + final SortedDocValues sindex = DocValues.getSorted(readerContext.reader(), field); // figure out what ord maps to true int nord = sindex.getValueCount(); diff --git a/solr/core/src/java/org/apache/solr/schema/EnumField.java b/solr/core/src/java/org/apache/solr/schema/EnumField.java index 507ec705f28..9fef1126a63 100644 --- a/solr/core/src/java/org/apache/solr/schema/EnumField.java +++ b/solr/core/src/java/org/apache/solr/schema/EnumField.java @@ -178,7 +178,7 @@ public class EnumField extends PrimitiveFieldType { public SortField getSortField(SchemaField field, boolean top) { field.checkSortability(); final Object missingValue = Integer.MIN_VALUE; - SortField sf = new SortField(field.getName(), SortField.Type.INT, top, FieldCache.NUMERIC_UTILS_INT_PARSER); + SortField sf = new SortField(field.getName(), SortField.Type.INT, top); sf.setMissingValue(missingValue); return sf; } @@ -189,7 +189,7 @@ public class EnumField extends PrimitiveFieldType { @Override public ValueSource getValueSource(SchemaField field, QParser qparser) { field.checkFieldCacheSource(qparser); - return new EnumFieldSource(field.getName(), FieldCache.NUMERIC_UTILS_INT_PARSER, enumIntToStringMap, enumStringToIntMap); + return new EnumFieldSource(field.getName(), enumIntToStringMap, enumStringToIntMap); } /** diff --git a/solr/core/src/java/org/apache/solr/schema/TrieField.java b/solr/core/src/java/org/apache/solr/schema/TrieField.java index 2142c383bb2..97c8a09a238 100644 --- a/solr/core/src/java/org/apache/solr/schema/TrieField.java +++ b/solr/core/src/java/org/apache/solr/schema/TrieField.java @@ -39,7 +39,6 @@ import org.apache.lucene.queries.function.valuesource.FloatFieldSource; import org.apache.lucene.queries.function.valuesource.IntFieldSource; import org.apache.lucene.queries.function.valuesource.LongFieldSource; import org.apache.lucene.search.ConstantScoreQuery; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.FieldCacheRangeFilter; import org.apache.lucene.search.NumericRangeQuery; import org.apache.lucene.search.Query; @@ -153,7 +152,7 @@ public class TrieField extends PrimitiveFieldType { else if( sortMissingFirst ) { missingValue = top ? Integer.MAX_VALUE : Integer.MIN_VALUE; } - sf = new SortField( field.getName(), SortField.Type.INT, top, FieldCache.NUMERIC_UTILS_INT_PARSER); + sf = new SortField( field.getName(), SortField.Type.INT, top); sf.setMissingValue(missingValue); return sf; @@ -164,7 +163,7 @@ public class TrieField extends PrimitiveFieldType { else if( sortMissingFirst ) { missingValue = top ? Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY; } - sf = new SortField( field.getName(), SortField.Type.FLOAT, top, FieldCache.NUMERIC_UTILS_FLOAT_PARSER); + sf = new SortField( field.getName(), SortField.Type.FLOAT, top); sf.setMissingValue(missingValue); return sf; @@ -176,7 +175,7 @@ public class TrieField extends PrimitiveFieldType { else if( sortMissingFirst ) { missingValue = top ? Long.MAX_VALUE : Long.MIN_VALUE; } - sf = new SortField( field.getName(), SortField.Type.LONG, top, FieldCache.NUMERIC_UTILS_LONG_PARSER); + sf = new SortField( field.getName(), SortField.Type.LONG, top); sf.setMissingValue(missingValue); return sf; @@ -187,7 +186,7 @@ public class TrieField extends PrimitiveFieldType { else if( sortMissingFirst ) { missingValue = top ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY; } - sf = new SortField( field.getName(), SortField.Type.DOUBLE, top, FieldCache.NUMERIC_UTILS_DOUBLE_PARSER); + sf = new SortField( field.getName(), SortField.Type.DOUBLE, top); sf.setMissingValue(missingValue); return sf; @@ -201,15 +200,15 @@ public class TrieField extends PrimitiveFieldType { field.checkFieldCacheSource(qparser); switch (type) { case INTEGER: - return new IntFieldSource( field.getName(), FieldCache.NUMERIC_UTILS_INT_PARSER ); + return new IntFieldSource( field.getName()); case FLOAT: - return new FloatFieldSource( field.getName(), FieldCache.NUMERIC_UTILS_FLOAT_PARSER ); + return new FloatFieldSource( field.getName()); case DATE: - return new TrieDateFieldSource( field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER ); + return new TrieDateFieldSource( field.getName()); case LONG: - return new LongFieldSource( field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER ); + return new LongFieldSource( field.getName()); case DOUBLE: - return new DoubleFieldSource( field.getName(), FieldCache.NUMERIC_UTILS_DOUBLE_PARSER ); + return new DoubleFieldSource( field.getName()); default: throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + field.name); } @@ -706,8 +705,8 @@ public class TrieField extends PrimitiveFieldType { class TrieDateFieldSource extends LongFieldSource { - public TrieDateFieldSource(String field, FieldCache.Parser parser) { - super(field, parser); + public TrieDateFieldSource(String field) { + super(field); } @Override diff --git a/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java index 9aa4c277afe..e2ddab4a756 100644 --- a/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java +++ b/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java @@ -27,6 +27,7 @@ import java.util.Set; import org.apache.lucene.index.AtomicReader; import org.apache.lucene.index.AtomicReaderContext; +import org.apache.lucene.index.DocValues; import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.NumericDocValues; import org.apache.lucene.index.SortedDocValues; @@ -38,7 +39,6 @@ import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.search.LeafCollector; import org.apache.lucene.search.Collector; import org.apache.lucene.search.DocIdSetIterator; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.FilterCollector; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; @@ -289,11 +289,7 @@ public class CollapsingQParserPlugin extends QParserPlugin { SortedDocValues docValues = null; FunctionQuery funcQuery = null; - if(schemaField.hasDocValues()) { - docValues = searcher.getAtomicReader().getSortedDocValues(this.field); - } else { - docValues = FieldCache.DEFAULT.getTermsIndex(searcher.getAtomicReader(), this.field); - } + docValues = DocValues.getSorted(searcher.getAtomicReader(), this.field); FieldType fieldType = null; @@ -830,7 +826,7 @@ public class CollapsingQParserPlugin extends QParserPlugin { } public void setNextReader(AtomicReaderContext context) throws IOException { - this.vals = FieldCache.DEFAULT.getNumerics(context.reader(), this.field, FieldCache.NUMERIC_UTILS_INT_PARSER, false); + this.vals = DocValues.getNumeric(context.reader(), this.field); } public void collapse(int ord, int contextDoc, int globalDoc) throws IOException { @@ -898,7 +894,7 @@ public class CollapsingQParserPlugin extends QParserPlugin { } public void setNextReader(AtomicReaderContext context) throws IOException { - this.vals = FieldCache.DEFAULT.getNumerics(context.reader(), this.field, FieldCache.NUMERIC_UTILS_LONG_PARSER, false); + this.vals = DocValues.getNumeric(context.reader(), this.field); } public void collapse(int ord, int contextDoc, int globalDoc) throws IOException { @@ -967,7 +963,7 @@ public class CollapsingQParserPlugin extends QParserPlugin { } public void setNextReader(AtomicReaderContext context) throws IOException { - this.vals = FieldCache.DEFAULT.getNumerics(context.reader(), this.field, FieldCache.NUMERIC_UTILS_FLOAT_PARSER, false); + this.vals = DocValues.getNumeric(context.reader(), this.field); } public void collapse(int ord, int contextDoc, int globalDoc) throws IOException { diff --git a/solr/core/src/java/org/apache/solr/search/SolrFieldCacheMBean.java b/solr/core/src/java/org/apache/solr/search/SolrFieldCacheMBean.java index 93d3686421d..1815800656a 100644 --- a/solr/core/src/java/org/apache/solr/search/SolrFieldCacheMBean.java +++ b/solr/core/src/java/org/apache/solr/search/SolrFieldCacheMBean.java @@ -25,18 +25,21 @@ 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 Lucene FieldCache, this is NOT a cache that is managed by Solr. + * A SolrInfoMBean that provides introspection of the Solr FieldCache * */ public class SolrFieldCacheMBean implements SolrInfoMBean { - protected FieldCacheSanityChecker checker = new FieldCacheSanityChecker(); + //protected FieldCacheSanityChecker checker = new FieldCacheSanityChecker(); @Override public String getName() { return this.getClass().getName(); } @@ -44,8 +47,7 @@ public class SolrFieldCacheMBean implements SolrInfoMBean { public String getVersion() { return SolrCore.version; } @Override public String getDescription() { - return "Provides introspection of the Lucene FieldCache, " - + "this is **NOT** a cache that is managed by Solr."; + return "Provides introspection of the Solr FieldCache "; } @Override public Category getCategory() { return Category.CACHE; } @@ -60,6 +62,7 @@ public class SolrFieldCacheMBean implements SolrInfoMBean { @Override public NamedList getStatistics() { NamedList stats = new SimpleOrderedMap(); + /* CacheEntry[] entries = FieldCache.DEFAULT.getCacheEntries(); stats.add("entries_count", entries.length); for (int i = 0; i < entries.length; i++) { @@ -71,17 +74,9 @@ public class SolrFieldCacheMBean implements SolrInfoMBean { stats.add("insanity_count", insanity.length); for (int i = 0; i < insanity.length; i++) { - - /** RAM estimation is both CPU and memory intensive... we don't want to do it unless asked. - // we only estimate the size of insane entries - for (CacheEntry e : insanity[i].getCacheEntries()) { - // don't re-estimate if we've already done it. - if (null == e.getEstimatedSize()) e.estimateSize(); - } - **/ stats.add("insanity#" + i, insanity[i].toString()); - } + }*/ return stats; } diff --git a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java index 6c06ec2e18c..aae9e74c539 100644 --- a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java +++ b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServerException; @@ -422,7 +421,8 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase { // Thread.sleep(10000000000L); - FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity + // nocommit: split test if needed + // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity del("*:*"); // delete all docs and test stats request commit(); diff --git a/solr/core/src/test/org/apache/solr/TestGroupingSearch.java b/solr/core/src/test/org/apache/solr/TestGroupingSearch.java index af34844046f..21cc06c46a5 100644 --- a/solr/core/src/test/org/apache/solr/TestGroupingSearch.java +++ b/solr/core/src/test/org/apache/solr/TestGroupingSearch.java @@ -17,7 +17,6 @@ package org.apache.solr; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.index.LogDocMergePolicy; import org.noggit.JSONUtil; import org.noggit.ObjectBuilder; @@ -518,7 +517,8 @@ public class TestGroupingSearch extends SolrTestCaseJ4 { ,"/grouped/"+f+"/matches==10" ,"/facet_counts/facet_fields/"+f+"==['1',3, '2',3, '3',2, '4',1, '5',1]" ); - FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity + // nocommit: split test if needed + // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity // test that grouping works with highlighting assertJQ(req("fq",filt, "q","{!func}"+f2, "group","true", "group.field",f, "fl","id" diff --git a/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java b/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java index 53334b3f0df..2e75b90c01c 100644 --- a/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java +++ b/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Map; import java.util.Random; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.lucene.util.LuceneTestCase.SuppressCodecs; @@ -134,7 +133,8 @@ public class TestRandomDVFaceting extends SolrTestCaseJ4 { } } } finally { - FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity + // nocommit: split test if needed + // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity } } diff --git a/solr/core/src/test/org/apache/solr/TestRandomFaceting.java b/solr/core/src/test/org/apache/solr/TestRandomFaceting.java index f2d4cd3231e..66b22515af4 100644 --- a/solr/core/src/test/org/apache/solr/TestRandomFaceting.java +++ b/solr/core/src/test/org/apache/solr/TestRandomFaceting.java @@ -17,7 +17,6 @@ package org.apache.solr; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.solr.common.params.ModifiableSolrParams; @@ -133,7 +132,8 @@ public class TestRandomFaceting extends SolrTestCaseJ4 { } } } finally { - FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity + // nocommit: split test if needed + // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity } } diff --git a/solr/core/src/test/org/apache/solr/request/TestFaceting.java b/solr/core/src/test/org/apache/solr/request/TestFaceting.java index 05fabc24712..3b9b7a4c82d 100644 --- a/solr/core/src/test/org/apache/solr/request/TestFaceting.java +++ b/solr/core/src/test/org/apache/solr/request/TestFaceting.java @@ -22,9 +22,9 @@ import java.util.List; import java.util.Locale; import java.util.Random; -import org.apache.lucene.index.DocTermOrds; import org.apache.lucene.index.Term; import org.apache.lucene.index.TermsEnum; +import org.apache.lucene.uninverting.DocTermOrds; import org.apache.lucene.util.BytesRef; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.params.FacetParams; 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.java index d5fe2bb6edf..db02d5ce391 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 @@ -19,7 +19,6 @@ package org.apache.solr.search.function; import org.apache.lucene.codecs.Codec; import org.apache.lucene.index.FieldInvertState; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.similarities.DefaultSimilarity; import org.apache.lucene.search.similarities.TFIDFSimilarity; import org.apache.solr.SolrTestCaseJ4; @@ -203,7 +202,8 @@ public class TestFunctionQuery extends SolrTestCaseJ4 { Arrays.asList("v1","\0:[* TO *]"), 88,12 ); - FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity + // nocommit: split test if needed + // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity } @Test @@ -285,7 +285,8 @@ public class TestFunctionQuery extends SolrTestCaseJ4 { // System.out.println("Done test "+i); } - FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity + // nocommit: split test if needed + // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity } @Test @@ -424,7 +425,8 @@ public class TestFunctionQuery extends SolrTestCaseJ4 { ); - FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity + // nocommit: split test if needed + // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity } /** @@ -642,7 +644,8 @@ public class TestFunctionQuery extends SolrTestCaseJ4 { singleTest(fieldAsFunc, "sqrt(\0)"); assertTrue(orig != FileFloatSource.onlyForTesting); - FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity + // nocommit: split test if needed + // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity } /** @@ -669,7 +672,8 @@ public class TestFunctionQuery extends SolrTestCaseJ4 { 100,10, 25,5, 0,0, 1,1); singleTest(fieldAsFunc, "log(\0)", 1,0); - FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity + // nocommit: split test if needed + // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity } @Test diff --git a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java index 55c57b21e04..0e56791deb2 100644 --- a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java @@ -35,7 +35,6 @@ import java.util.concurrent.atomic.AtomicInteger; import junit.framework.Assert; import org.apache.commons.io.FileUtils; -import org.apache.lucene.search.FieldCache; import org.apache.lucene.util.Constants; import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.TestUtil; @@ -284,7 +283,8 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 { @Override public void tearDown() throws Exception { destroyServers(); - FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity + // nocommit: split test if needed + // FieldCache.DEFAULT.purgeAllCaches(); // hide FC insanity super.tearDown(); }