You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/12/11 22:13:43 UTC
svn commit: r1719562 [1/8] - in /lucene/dev/trunk: lucene/
lucene/analysis/common/src/test/org/apache/lucene/analysis/core/
lucene/backward-codecs/src/test/org/apache/lucene/index/
lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ luc...
Author: mikemccand
Date: Fri Dec 11 21:13:41 2015
New Revision: 1719562
URL: http://svn.apache.org/viewvc?rev=1719562&view=rev
Log:
LUCENE-6917: rename/deprecate numeric classes in favor of dimensional values
Added:
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/analysis/LegacyNumericTokenStream.java
- copied, changed from r1719561, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/analysis/NumericTokenStream.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalBinaryField.java
- copied, changed from r1718974, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalDoubleField.java (with props)
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalFloatField.java (with props)
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalIntField.java (with props)
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalLongField.java (with props)
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/LegacyDoubleField.java
- copied, changed from r1718974, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DoubleField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/LegacyFloatField.java
- copied, changed from r1718974, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/FloatField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/LegacyIntField.java
- copied, changed from r1718974, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/IntField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/LegacyLongField.java
- copied, changed from r1718974, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/LongField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/LegacyNumericRangeQuery.java
- copied, changed from r1718974, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/NumericRangeQuery.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/LegacyNumericUtils.java
- copied, changed from r1718974, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/NumericUtils.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/NumericUtils.java (with props)
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/TestLegacyNumericUtils.java
- copied, changed from r1718974, lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java
lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/LegacyNumericRangeQueryBuilder.java
- copied, changed from r1718974, lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/NumericRangeQueryBuilder.java
lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQuery.xml
- copied, changed from r1718974, lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/NumericRangeQuery.xml
Removed:
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/analysis/NumericTokenStream.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DoubleField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/FloatField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/IntField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/LongField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/NumericRangeQuery.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/bkd/BKDUtil.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/TestNumericUtils.java
lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/NumericRangeQueryBuilder.java
lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/NumericRangeQuery.xml
Modified:
lucene/dev/trunk/lucene/CHANGES.txt
lucene/dev/trunk/lucene/MIGRATE.txt
lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestTypeTokenFilterFactory.java
lucene/dev/trunk/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java
lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60FieldInfosFormat.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DateTools.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/Document.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/Field.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/FieldType.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesField.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/package-info.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DimensionalValues.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/StoredDocument.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/DimensionalRangeQuery.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/Query.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/SortedNumericSelector.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/UsageTrackingQueryCachingPolicy.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/package-info.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/bkd/BKDReader.java
lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/TestSearch.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/TestSearchForDuplicates.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/analysis/TestNumericTokenStream.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/document/TestDocument.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/document/TestField.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/document/TestFieldType.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDemoParallelLeafReader.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDimensionalValues.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestFieldReuse.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestTerms.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/BaseTestRangeFilter.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestDimensionalRangeQuery.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestLiveFieldValues.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestSortedNumericSortField.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/search/TestUsageTrackingFilterCachingPolicy.java
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/DistanceFacetsExample.java
lucene/dev/trunk/lucene/demo/src/java/org/apache/lucene/demo/facet/RangeFacetsExample.java
lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/range/DoubleRange.java
lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/range/DoubleRangeFacetCounts.java
lucene/dev/trunk/lucene/facet/src/java/org/apache/lucene/facet/range/Range.java
lucene/dev/trunk/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java
lucene/dev/trunk/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java
lucene/dev/trunk/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
lucene/dev/trunk/lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/DocValuesTermsCollector.java
lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/JoinUtil.java
lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java
lucene/dev/trunk/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java
lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java
lucene/dev/trunk/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCache.java
lucene/dev/trunk/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/index/SorterTestBase.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/search/TestDiversifiedTopDocsCollector.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestDocTermOrds.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCache.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheReopen.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSanityChecker.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSort.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestFieldCacheSortRandom.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestNumericTerms32.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestNumericTerms64.java
lucene/dev/trunk/lucene/misc/src/test/org/apache/lucene/uninverting/TestUninvertingReader.java
lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java
lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionQuerySort.java
lucene/dev/trunk/lucene/queries/src/test/org/apache/lucene/queries/function/TestValueSources.java
lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/builders/NumericRangeQueryNodeBuilder.java
lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/config/NumericConfig.java
lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/nodes/NumericRangeQueryNode.java
lucene/dev/trunk/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java
lucene/dev/trunk/lucene/queryparser/src/resources/org/apache/lucene/queryparser/xml/LuceneCoreQuery.dtd
lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestNumericQueryParser.java
lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java
lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/builders/TestNumericRangeQueryBuilder.java
lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/document/DimensionalLatLonField.java
lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/document/GeoPointField.java
lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/search/DimensionalPointInPolygonQuery.java
lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/search/DimensionalPointInRectQuery.java
lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/search/DocValuesRangeQuery.java
lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/search/GeoPointInBBoxQuery.java
lucene/dev/trunk/lucene/sandbox/src/java/org/apache/lucene/search/GeoPointTermsEnum.java
lucene/dev/trunk/lucene/sandbox/src/test/org/apache/lucene/search/TestDocValuesRangeQuery.java
lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java
lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/BytesRefIteratorTokenStream.java
lucene/dev/trunk/lucene/spatial/src/java/org/apache/lucene/spatial/vector/PointVectorStrategy.java
lucene/dev/trunk/lucene/spatial3d/src/java/org/apache/lucene/geo3d/Geo3DPointField.java
lucene/dev/trunk/lucene/spatial3d/src/java/org/apache/lucene/geo3d/PointInGeo3DShapeQuery.java
lucene/dev/trunk/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
lucene/dev/trunk/lucene/test-framework/src/test/org/apache/lucene/codecs/compressing/TestCompressingStoredFieldsFormat.java
lucene/dev/trunk/lucene/tools/junit4/cached-timehints.txt
lucene/dev/trunk/solr/contrib/analytics/src/java/org/apache/solr/analytics/util/AnalyticsParsers.java
lucene/dev/trunk/solr/contrib/analytics/src/java/org/apache/solr/analytics/util/valuesource/DateFieldSource.java
lucene/dev/trunk/solr/contrib/clustering/src/test-files/clustering/solr/collection1/conf/schema.xml
lucene/dev/trunk/solr/contrib/dataimporthandler/src/test-files/dih/solr/collection1/conf/dataimport-solr_id-schema.xml
lucene/dev/trunk/solr/contrib/extraction/src/test-files/extraction/solr/collection1/conf/schema.xml
lucene/dev/trunk/solr/contrib/morphlines-core/src/test-files/solr/collection1/conf/schema.xml
lucene/dev/trunk/solr/contrib/morphlines-core/src/test-files/solr/minimr/conf/schema.xml
lucene/dev/trunk/solr/contrib/morphlines-core/src/test-files/solr/mrunit/conf/schema.xml
lucene/dev/trunk/solr/contrib/morphlines-core/src/test-files/solr/solrcelltest/collection1/conf/schema.xml
lucene/dev/trunk/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/schema.xml
lucene/dev/trunk/solr/contrib/uima/src/test-files/uima/uima-tokenizers-schema.xml
lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/StatsField.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/request/IntervalFacets.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/request/NumericFacets.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/EnumField.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/ExternalFileField.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/FieldType.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/TrieDoubleField.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/TrieField.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/TrieFloatField.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/TrieIntField.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/TrieLongField.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/QueryParsing.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/QueryWrapperFilter.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/facet/FacetField.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/facet/FacetRange.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/VersionInfo.java
lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-binaryfield.xml
lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-copyfield-test.xml
lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-customfield.xml
lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-required-fields.xml
lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema_latest.xml
lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/SpatialFilterTest.java
lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestMaxScoreQueryParser.java
lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/function/TestOrdValues.java
Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Fri Dec 11 21:13:41 2015
@@ -86,6 +86,9 @@ API Changes
IndexOutput.getName returns its name (Dawid Weiss, Robert Muir, Mike
McCandless)
+* LUCENE-6917: Deprecate and rename NumericXXX classes to
+ LegacyNumericXXX in favor of dimensional values (Mike McCandless)
+
Optimizations
* LUCENE-6891: Use prefix coding when writing dimensional values in
Modified: lucene/dev/trunk/lucene/MIGRATE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/MIGRATE.txt?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/MIGRATE.txt (original)
+++ lucene/dev/trunk/lucene/MIGRATE.txt Fri Dec 11 21:13:41 2015
@@ -80,3 +80,11 @@ would be equivalent to the following cod
Query q = ...;
float boost = ...;
q.setBoost(q.getBoost() * boost);
+
+## DimensionalValues replaces NumericField (LUCENE-6917)
+
+DimensionalValues provides faster indexing and searching, a smaller
+index size, and less heap used at search time. The numeric fields
+(IntField, FloatField, LongField, DoubleField) and NumericRangeQuery
+have been moved to the backward-codecs module and prefixed with
+Legacy.
Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestTypeTokenFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestTypeTokenFilterFactory.java?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestTypeTokenFilterFactory.java (original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestTypeTokenFilterFactory.java Fri Dec 11 21:13:41 2015
@@ -17,12 +17,12 @@ package org.apache.lucene.analysis.core;
* limitations under the License.
*/
-import org.apache.lucene.analysis.NumericTokenStream;
+import java.util.Set;
+
+import org.apache.lucene.analysis.CannedTokenStream;
import org.apache.lucene.analysis.util.BaseTokenStreamFactoryTestCase;
import org.apache.lucene.analysis.util.TokenFilterFactory;
-import java.util.Set;
-
/**
* Testcase for {@link TypeTokenFilterFactory}
*/
@@ -46,8 +46,7 @@ public class TestTypeTokenFilterFactory
public void testCreationWithBlackList() throws Exception {
TokenFilterFactory factory = tokenFilterFactory("Type",
"types", "stoptypes-1.txt, stoptypes-2.txt");
- NumericTokenStream input = new NumericTokenStream();
- input.setIntValue(123);
+ CannedTokenStream input = new CannedTokenStream();
factory.create(input);
}
@@ -55,8 +54,7 @@ public class TestTypeTokenFilterFactory
TokenFilterFactory factory = tokenFilterFactory("Type",
"types", "stoptypes-1.txt, stoptypes-2.txt",
"useWhitelist", "true");
- NumericTokenStream input = new NumericTokenStream();
- input.setIntValue(123);
+ CannedTokenStream input = new CannedTokenStream();
factory.create(input);
}
Modified: lucene/dev/trunk/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (original)
+++ lucene/dev/trunk/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java Fri Dec 11 21:13:41 2015
@@ -43,8 +43,8 @@ import org.apache.lucene.document.Double
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.FloatDocValuesField;
-import org.apache.lucene.document.IntField;
-import org.apache.lucene.document.LongField;
+import org.apache.lucene.document.LegacyIntField;
+import org.apache.lucene.document.LegacyLongField;
import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.document.SortedDocValuesField;
import org.apache.lucene.document.SortedNumericDocValuesField;
@@ -54,7 +54,7 @@ import org.apache.lucene.document.TextFi
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.NumericRangeQuery;
+import org.apache.lucene.search.LegacyNumericRangeQuery;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.BaseDirectoryWrapper;
@@ -68,9 +68,9 @@ import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.InfoStream;
+import org.apache.lucene.util.LegacyNumericUtils;
import org.apache.lucene.util.LineFileDocs;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.Version;
import org.junit.AfterClass;
@@ -939,8 +939,8 @@ public class TestBackwardsCompatibility
doc.add(new Field("content2", "here is more content with aaa aaa aaa", customType2));
doc.add(new Field("fie\u2C77ld", "field with non-ascii name", customType2));
// add numeric fields, to test if flex preserves encoding
- doc.add(new IntField("trieInt", id, Field.Store.NO));
- doc.add(new LongField("trieLong", (long) id, Field.Store.NO));
+ doc.add(new LegacyIntField("trieInt", id, Field.Store.NO));
+ doc.add(new LegacyLongField("trieLong", (long) id, Field.Store.NO));
// add docvalues fields
doc.add(new NumericDocValuesField("dvByte", (byte) id));
byte bytes[] = new byte[] {
@@ -1103,36 +1103,36 @@ public class TestBackwardsCompatibility
IndexSearcher searcher = newSearcher(reader);
for (int id=10; id<15; id++) {
- ScoreDoc[] hits = searcher.search(NumericRangeQuery.newIntRange("trieInt", NumericUtils.PRECISION_STEP_DEFAULT_32, Integer.valueOf(id), Integer.valueOf(id), true, true), 100).scoreDocs;
+ ScoreDoc[] hits = searcher.search(LegacyNumericRangeQuery.newIntRange("trieInt", LegacyNumericUtils.PRECISION_STEP_DEFAULT_32, Integer.valueOf(id), Integer.valueOf(id), true, true), 100).scoreDocs;
assertEquals("wrong number of hits", 1, hits.length);
StoredDocument d = searcher.doc(hits[0].doc);
assertEquals(String.valueOf(id), d.get("id"));
- hits = searcher.search(NumericRangeQuery.newLongRange("trieLong", NumericUtils.PRECISION_STEP_DEFAULT, Long.valueOf(id), Long.valueOf(id), true, true), 100).scoreDocs;
+ hits = searcher.search(LegacyNumericRangeQuery.newLongRange("trieLong", LegacyNumericUtils.PRECISION_STEP_DEFAULT, Long.valueOf(id), Long.valueOf(id), true, true), 100).scoreDocs;
assertEquals("wrong number of hits", 1, hits.length);
d = searcher.doc(hits[0].doc);
assertEquals(String.valueOf(id), d.get("id"));
}
// check that also lower-precision fields are ok
- ScoreDoc[] hits = searcher.search(NumericRangeQuery.newIntRange("trieInt", NumericUtils.PRECISION_STEP_DEFAULT_32, Integer.MIN_VALUE, Integer.MAX_VALUE, false, false), 100).scoreDocs;
+ ScoreDoc[] hits = searcher.search(LegacyNumericRangeQuery.newIntRange("trieInt", LegacyNumericUtils.PRECISION_STEP_DEFAULT_32, Integer.MIN_VALUE, Integer.MAX_VALUE, false, false), 100).scoreDocs;
assertEquals("wrong number of hits", 34, hits.length);
- hits = searcher.search(NumericRangeQuery.newLongRange("trieLong", NumericUtils.PRECISION_STEP_DEFAULT, Long.MIN_VALUE, Long.MAX_VALUE, false, false), 100).scoreDocs;
+ hits = searcher.search(LegacyNumericRangeQuery.newLongRange("trieLong", LegacyNumericUtils.PRECISION_STEP_DEFAULT, Long.MIN_VALUE, Long.MAX_VALUE, false, false), 100).scoreDocs;
assertEquals("wrong number of hits", 34, hits.length);
// check decoding of terms
Terms terms = MultiFields.getTerms(searcher.getIndexReader(), "trieInt");
- TermsEnum termsEnum = NumericUtils.filterPrefixCodedInts(terms.iterator());
+ TermsEnum termsEnum = LegacyNumericUtils.filterPrefixCodedInts(terms.iterator());
while (termsEnum.next() != null) {
- int val = NumericUtils.prefixCodedToInt(termsEnum.term());
+ int val = LegacyNumericUtils.prefixCodedToInt(termsEnum.term());
assertTrue("value in id bounds", val >= 0 && val < 35);
}
terms = MultiFields.getTerms(searcher.getIndexReader(), "trieLong");
- termsEnum = NumericUtils.filterPrefixCodedLongs(terms.iterator());
+ termsEnum = LegacyNumericUtils.filterPrefixCodedLongs(terms.iterator());
while (termsEnum.next() != null) {
- long val = NumericUtils.prefixCodedToLong(termsEnum.term());
+ long val = LegacyNumericUtils.prefixCodedToLong(termsEnum.term());
assertTrue("value in id bounds", val >= 0L && val < 35L);
}
Modified: lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java (original)
+++ lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java Fri Dec 11 21:13:41 2015
@@ -36,12 +36,12 @@ import java.util.concurrent.atomic.Atomi
import org.apache.lucene.benchmark.byTask.utils.Config;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.FieldType.NumericType;
+import org.apache.lucene.document.FieldType.LegacyNumericType;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.document.IntField;
-import org.apache.lucene.document.LongField;
-import org.apache.lucene.document.FloatField;
-import org.apache.lucene.document.DoubleField;
+import org.apache.lucene.document.LegacyIntField;
+import org.apache.lucene.document.LegacyDoubleField;
+import org.apache.lucene.document.LegacyLongField;
+import org.apache.lucene.document.LegacyFloatField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
@@ -119,8 +119,8 @@ public class DocMaker implements Closeab
fields.put(ID_FIELD, new StringField(ID_FIELD, "", Field.Store.YES));
fields.put(NAME_FIELD, new Field(NAME_FIELD, "", ft));
- numericFields.put(DATE_MSEC_FIELD, new LongField(DATE_MSEC_FIELD, 0L, Field.Store.NO));
- numericFields.put(TIME_SEC_FIELD, new IntField(TIME_SEC_FIELD, 0, Field.Store.NO));
+ numericFields.put(DATE_MSEC_FIELD, new LegacyLongField(DATE_MSEC_FIELD, 0L, Field.Store.NO));
+ numericFields.put(TIME_SEC_FIELD, new LegacyIntField(TIME_SEC_FIELD, 0, Field.Store.NO));
doc = new Document();
} else {
@@ -148,7 +148,7 @@ public class DocMaker implements Closeab
return f;
}
- Field getNumericField(String name, NumericType type) {
+ Field getNumericField(String name, LegacyNumericType type) {
Field f;
if (reuseFields) {
f = numericFields.get(name);
@@ -159,16 +159,16 @@ public class DocMaker implements Closeab
if (f == null) {
switch(type) {
case INT:
- f = new IntField(name, 0, Field.Store.NO);
+ f = new LegacyIntField(name, 0, Field.Store.NO);
break;
case LONG:
- f = new LongField(name, 0L, Field.Store.NO);
+ f = new LegacyLongField(name, 0L, Field.Store.NO);
break;
case FLOAT:
- f = new FloatField(name, 0.0F, Field.Store.NO);
+ f = new LegacyFloatField(name, 0.0F, Field.Store.NO);
break;
case DOUBLE:
- f = new DoubleField(name, 0.0, Field.Store.NO);
+ f = new LegacyDoubleField(name, 0.0, Field.Store.NO);
break;
default:
throw new AssertionError("Cannot get here");
@@ -278,14 +278,14 @@ public class DocMaker implements Closeab
date = new Date();
}
- Field dateField = ds.getNumericField(DATE_MSEC_FIELD, NumericType.LONG);
+ Field dateField = ds.getNumericField(DATE_MSEC_FIELD, FieldType.LegacyNumericType.LONG);
dateField.setLongValue(date.getTime());
doc.add(dateField);
util.cal.setTime(date);
final int sec = util.cal.get(Calendar.HOUR_OF_DAY)*3600 + util.cal.get(Calendar.MINUTE)*60 + util.cal.get(Calendar.SECOND);
- Field timeSecField = ds.getNumericField(TIME_SEC_FIELD, NumericType.INT);
+ Field timeSecField = ds.getNumericField(TIME_SEC_FIELD, LegacyNumericType.INT);
timeSecField.setIntValue(sec);
doc.add(timeSecField);
Modified: lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java (original)
+++ lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java Fri Dec 11 21:13:41 2015
@@ -27,11 +27,10 @@ import org.apache.lucene.benchmark.byTas
import org.apache.lucene.benchmark.byTask.feeds.DocMaker;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.IntField;
-import org.apache.lucene.document.LongField;
-import org.apache.lucene.document.FloatField;
-import org.apache.lucene.document.DoubleField;
-import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.document.LegacyFloatField;
+import org.apache.lucene.document.LegacyIntField;
+import org.apache.lucene.document.LegacyDoubleField;
+import org.apache.lucene.document.LegacyLongField;
/**
* Simple task to test performance of tokenizers. It just
@@ -74,10 +73,10 @@ public class ReadTokensTask extends Perf
int tokenCount = 0;
for(final Field field : fields) {
if (!field.fieldType().tokenized() ||
- field instanceof IntField ||
- field instanceof LongField ||
- field instanceof FloatField ||
- field instanceof DoubleField) {
+ field instanceof LegacyIntField ||
+ field instanceof LegacyLongField ||
+ field instanceof LegacyFloatField ||
+ field instanceof LegacyDoubleField) {
continue;
}
Copied: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/analysis/LegacyNumericTokenStream.java (from r1719561, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/analysis/NumericTokenStream.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/analysis/LegacyNumericTokenStream.java?p2=lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/analysis/LegacyNumericTokenStream.java&p1=lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/analysis/NumericTokenStream.java&r1=1719561&r2=1719562&rev=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/analysis/NumericTokenStream.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/analysis/LegacyNumericTokenStream.java Fri Dec 11 21:13:41 2015
@@ -23,26 +23,22 @@ import org.apache.lucene.analysis.tokena
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute;
import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
-import org.apache.lucene.document.DoubleField; // for javadocs
-import org.apache.lucene.document.FloatField; // for javadocs
-import org.apache.lucene.document.IntField; // for javadocs
-import org.apache.lucene.document.LongField; // for javadocs
-import org.apache.lucene.search.NumericRangeQuery;
+import org.apache.lucene.index.DimensionalValues;
import org.apache.lucene.util.Attribute;
import org.apache.lucene.util.AttributeFactory;
import org.apache.lucene.util.AttributeImpl;
import org.apache.lucene.util.AttributeReflector;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefBuilder;
-import org.apache.lucene.util.NumericUtils;
+import org.apache.lucene.util.LegacyNumericUtils;
/**
* <b>Expert:</b> This class provides a {@link TokenStream}
* for indexing numeric values that can be used by {@link
- * NumericRangeQuery}.
+ * org.apache.lucene.search.LegacyNumericRangeQuery}.
*
- * <p>Note that for simple usage, {@link IntField}, {@link
- * LongField}, {@link FloatField} or {@link DoubleField} is
+ * <p>Note that for simple usage, {@link org.apache.lucene.document.LegacyIntField}, {@link
+ * org.apache.lucene.document.LegacyLongField}, {@link org.apache.lucene.document.LegacyFloatField} or {@link org.apache.lucene.document.LegacyDoubleField} is
* recommended. These fields disable norms and
* term freqs, as they are not usually needed during
* searching. If you need to change these settings, you
@@ -54,7 +50,7 @@ import org.apache.lucene.util.NumericUti
* FieldType fieldType = new FieldType(TextField.TYPE_NOT_STORED);
* fieldType.setOmitNorms(true);
* fieldType.setIndexOptions(IndexOptions.DOCS_ONLY);
- * Field field = new Field(name, new NumericTokenStream(precisionStep).setIntValue(value), fieldType);
+ * Field field = new Field(name, new LegacyNumericTokenStream(precisionStep).setIntValue(value), fieldType);
* document.add(field);
* </pre>
*
@@ -62,7 +58,7 @@ import org.apache.lucene.util.NumericUti
* for more than one document:
*
* <pre class="prettyprint">
- * NumericTokenStream stream = new NumericTokenStream(precisionStep);
+ * LegacyNumericTokenStream stream = new LegacyNumericTokenStream(precisionStep);
* FieldType fieldType = new FieldType(TextField.TYPE_NOT_STORED);
* fieldType.setOmitNorms(true);
* fieldType.setIndexOptions(IndexOptions.DOCS_ONLY);
@@ -82,17 +78,20 @@ import org.apache.lucene.util.NumericUti
* <p><b>NOTE</b>: as token streams are only consumed once
* the document is added to the index, if you index more
- * than one numeric field, use a separate <code>NumericTokenStream</code>
+ * than one numeric field, use a separate <code>LegacyNumericTokenStream</code>
* instance for each.</p>
*
- * <p>See {@link NumericRangeQuery} for more details on the
+ * <p>See {@link org.apache.lucene.search.LegacyNumericRangeQuery} for more details on the
* <a
- * href="../search/NumericRangeQuery.html#precisionStepDesc"><code>precisionStep</code></a>
+ * href="../search/LegacyNumericRangeQuery.html#precisionStepDesc"><code>precisionStep</code></a>
* parameter as well as how numeric fields work under the hood.</p>
*
+ * @deprecated Please switch to {@link DimensionalValues} instead
+ *
* @since 2.9
*/
-public final class NumericTokenStream extends TokenStream {
+@Deprecated
+public final class LegacyNumericTokenStream extends TokenStream {
/** The full precision token gets this token type assigned. */
public static final String TOKEN_TYPE_FULL_PREC = "fullPrecNumeric";
@@ -104,7 +103,7 @@ public final class NumericTokenStream ex
* @lucene.experimental
* @since 4.0
*/
- public interface NumericTermAttribute extends Attribute {
+ public interface LegacyNumericTermAttribute extends Attribute {
/** Returns current shift value, undefined before first token */
int getShift();
/** Returns current token's raw value as {@code long} with all {@link #getShift} applied, undefined before first token */
@@ -136,16 +135,16 @@ public final class NumericTokenStream ex
@Override
public AttributeImpl createAttributeInstance(Class<? extends Attribute> attClass) {
if (CharTermAttribute.class.isAssignableFrom(attClass))
- throw new IllegalArgumentException("NumericTokenStream does not support CharTermAttribute.");
+ throw new IllegalArgumentException("LegacyNumericTokenStream does not support CharTermAttribute.");
return delegate.createAttributeInstance(attClass);
}
}
- /** Implementation of {@link NumericTermAttribute}.
+ /** Implementation of {@link org.apache.lucene.analysis.LegacyNumericTokenStream.LegacyNumericTermAttribute}.
* @lucene.internal
* @since 4.0
*/
- public static final class NumericTermAttributeImpl extends AttributeImpl implements NumericTermAttribute,TermToBytesRefAttribute {
+ public static final class LegacyNumericTermAttributeImpl extends AttributeImpl implements LegacyNumericTermAttribute,TermToBytesRefAttribute {
private long value = 0L;
private int valueSize = 0, shift = 0, precisionStep = 0;
private BytesRefBuilder bytes = new BytesRefBuilder();
@@ -154,15 +153,15 @@ public final class NumericTokenStream ex
* Creates, but does not yet initialize this attribute instance
* @see #init(long, int, int, int)
*/
- public NumericTermAttributeImpl() {}
+ public LegacyNumericTermAttributeImpl() {}
@Override
public BytesRef getBytesRef() {
assert valueSize == 64 || valueSize == 32;
if (valueSize == 64) {
- NumericUtils.longToPrefixCoded(value, shift, bytes);
+ LegacyNumericUtils.longToPrefixCoded(value, shift, bytes);
} else {
- NumericUtils.intToPrefixCoded((int) value, shift, bytes);
+ LegacyNumericUtils.intToPrefixCoded((int) value, shift, bytes);
}
return bytes.get();
}
@@ -198,20 +197,20 @@ public final class NumericTokenStream ex
@Override
public void reflectWith(AttributeReflector reflector) {
reflector.reflect(TermToBytesRefAttribute.class, "bytes", getBytesRef());
- reflector.reflect(NumericTermAttribute.class, "shift", shift);
- reflector.reflect(NumericTermAttribute.class, "rawValue", getRawValue());
- reflector.reflect(NumericTermAttribute.class, "valueSize", valueSize);
+ reflector.reflect(LegacyNumericTermAttribute.class, "shift", shift);
+ reflector.reflect(LegacyNumericTermAttribute.class, "rawValue", getRawValue());
+ reflector.reflect(LegacyNumericTermAttribute.class, "valueSize", valueSize);
}
@Override
public void copyTo(AttributeImpl target) {
- final NumericTermAttribute a = (NumericTermAttribute) target;
+ final LegacyNumericTermAttribute a = (LegacyNumericTermAttribute) target;
a.init(value, valueSize, precisionStep, shift);
}
@Override
- public NumericTermAttributeImpl clone() {
- NumericTermAttributeImpl t = (NumericTermAttributeImpl)super.clone();
+ public LegacyNumericTermAttributeImpl clone() {
+ LegacyNumericTermAttributeImpl t = (LegacyNumericTermAttributeImpl)super.clone();
// Do a deep clone
t.bytes = new BytesRefBuilder();
t.bytes.copyBytes(getBytesRef());
@@ -228,7 +227,7 @@ public final class NumericTokenStream ex
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
- NumericTermAttributeImpl other = (NumericTermAttributeImpl) obj;
+ LegacyNumericTermAttributeImpl other = (LegacyNumericTermAttributeImpl) obj;
if (precisionStep != other.precisionStep) return false;
if (shift != other.shift) return false;
if (value != other.value) return false;
@@ -239,11 +238,11 @@ public final class NumericTokenStream ex
/**
* Creates a token stream for numeric values using the default <code>precisionStep</code>
- * {@link NumericUtils#PRECISION_STEP_DEFAULT} (16). The stream is not yet initialized,
+ * {@link org.apache.lucene.util.LegacyNumericUtils#PRECISION_STEP_DEFAULT} (16). The stream is not yet initialized,
* before using set a value using the various set<em>???</em>Value() methods.
*/
- public NumericTokenStream() {
- this(AttributeFactory.DEFAULT_ATTRIBUTE_FACTORY, NumericUtils.PRECISION_STEP_DEFAULT);
+ public LegacyNumericTokenStream() {
+ this(AttributeFactory.DEFAULT_ATTRIBUTE_FACTORY, LegacyNumericUtils.PRECISION_STEP_DEFAULT);
}
/**
@@ -251,7 +250,7 @@ public final class NumericTokenStream ex
* <code>precisionStep</code>. The stream is not yet initialized,
* before using set a value using the various set<em>???</em>Value() methods.
*/
- public NumericTokenStream(final int precisionStep) {
+ public LegacyNumericTokenStream(final int precisionStep) {
this(AttributeFactory.DEFAULT_ATTRIBUTE_FACTORY, precisionStep);
}
@@ -262,7 +261,7 @@ public final class NumericTokenStream ex
* The stream is not yet initialized,
* before using set a value using the various set<em>???</em>Value() methods.
*/
- public NumericTokenStream(AttributeFactory factory, final int precisionStep) {
+ public LegacyNumericTokenStream(AttributeFactory factory, final int precisionStep) {
super(new NumericAttributeFactory(factory));
if (precisionStep < 1)
throw new IllegalArgumentException("precisionStep must be >=1");
@@ -274,9 +273,9 @@ public final class NumericTokenStream ex
* Initializes the token stream with the supplied <code>long</code> value.
* @param value the value, for which this TokenStream should enumerate tokens.
* @return this instance, because of this you can use it the following way:
- * <code>new Field(name, new NumericTokenStream(precisionStep).setLongValue(value))</code>
+ * <code>new Field(name, new LegacyNumericTokenStream(precisionStep).setLongValue(value))</code>
*/
- public NumericTokenStream setLongValue(final long value) {
+ public LegacyNumericTokenStream setLongValue(final long value) {
numericAtt.init(value, valSize = 64, precisionStep, -precisionStep);
return this;
}
@@ -285,9 +284,9 @@ public final class NumericTokenStream ex
* Initializes the token stream with the supplied <code>int</code> value.
* @param value the value, for which this TokenStream should enumerate tokens.
* @return this instance, because of this you can use it the following way:
- * <code>new Field(name, new NumericTokenStream(precisionStep).setIntValue(value))</code>
+ * <code>new Field(name, new LegacyNumericTokenStream(precisionStep).setIntValue(value))</code>
*/
- public NumericTokenStream setIntValue(final int value) {
+ public LegacyNumericTokenStream setIntValue(final int value) {
numericAtt.init(value, valSize = 32, precisionStep, -precisionStep);
return this;
}
@@ -296,10 +295,10 @@ public final class NumericTokenStream ex
* Initializes the token stream with the supplied <code>double</code> value.
* @param value the value, for which this TokenStream should enumerate tokens.
* @return this instance, because of this you can use it the following way:
- * <code>new Field(name, new NumericTokenStream(precisionStep).setDoubleValue(value))</code>
+ * <code>new Field(name, new LegacyNumericTokenStream(precisionStep).setDoubleValue(value))</code>
*/
- public NumericTokenStream setDoubleValue(final double value) {
- numericAtt.init(NumericUtils.doubleToSortableLong(value), valSize = 64, precisionStep, -precisionStep);
+ public LegacyNumericTokenStream setDoubleValue(final double value) {
+ numericAtt.init(LegacyNumericUtils.doubleToSortableLong(value), valSize = 64, precisionStep, -precisionStep);
return this;
}
@@ -307,10 +306,10 @@ public final class NumericTokenStream ex
* Initializes the token stream with the supplied <code>float</code> value.
* @param value the value, for which this TokenStream should enumerate tokens.
* @return this instance, because of this you can use it the following way:
- * <code>new Field(name, new NumericTokenStream(precisionStep).setFloatValue(value))</code>
+ * <code>new Field(name, new LegacyNumericTokenStream(precisionStep).setFloatValue(value))</code>
*/
- public NumericTokenStream setFloatValue(final float value) {
- numericAtt.init(NumericUtils.floatToSortableInt(value), valSize = 32, precisionStep, -precisionStep);
+ public LegacyNumericTokenStream setFloatValue(final float value) {
+ numericAtt.init(LegacyNumericUtils.floatToSortableInt(value), valSize = 32, precisionStep, -precisionStep);
return this;
}
@@ -347,7 +346,7 @@ public final class NumericTokenStream ex
}
// members
- private final NumericTermAttribute numericAtt = addAttribute(NumericTermAttribute.class);
+ private final LegacyNumericTermAttribute numericAtt = addAttribute(LegacyNumericTermAttribute.class);
private final TypeAttribute typeAtt = addAttribute(TypeAttribute.class);
private final PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class);
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60FieldInfosFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60FieldInfosFormat.java?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60FieldInfosFormat.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60FieldInfosFormat.java Fri Dec 11 21:13:41 2015
@@ -24,7 +24,7 @@ import java.util.Map;
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.codecs.FieldInfosFormat;
-import org.apache.lucene.document.DimensionalField;
+import org.apache.lucene.document.DimensionalLongField;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.FieldInfo;
@@ -97,7 +97,7 @@ import org.apache.lucene.store.IndexOutp
* are updates stored by {@link DocValuesFormat}.</li>
* <li>Attributes: a key-value map of codec-private attributes.</li>
* <li>DimensionCount, DimensionNumBytes: these are non-zero only if the field is
- * indexed dimensionally using {@link DimensionalField}</li>
+ * indexed dimensionally, e.g. using {@link DimensionalLongField}</li>
* </ul>
*
* @lucene.experimental
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DateTools.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DateTools.java?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DateTools.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DateTools.java Fri Dec 11 21:13:41 2015
@@ -17,11 +17,6 @@ package org.apache.lucene.document;
* limitations under the License.
*/
-import org.apache.lucene.search.NumericRangeQuery; // for javadocs
-import org.apache.lucene.search.PrefixQuery;
-import org.apache.lucene.search.TermRangeQuery;
-import org.apache.lucene.util.NumericUtils; // for javadocs
-
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -29,6 +24,10 @@ import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
+import org.apache.lucene.search.DimensionalRangeQuery;
+import org.apache.lucene.search.PrefixQuery;
+import org.apache.lucene.search.TermRangeQuery;
+
/**
* Provides support for converting dates to strings and vice-versa.
* The strings are structured so that lexicographic sorting orders
@@ -40,13 +39,12 @@ import java.util.TimeZone;
* {@link TermRangeQuery} and {@link PrefixQuery} will require more memory and become slower.
*
* <P>
- * Another approach is {@link NumericUtils}, which provides
- * a sortable binary representation (prefix encoded) of numeric values, which
- * date/time are.
+ * Another approach is {@link DimensionalLongField}, which indexes the
+ * values in sorted order.
* For indexing a {@link Date} or {@link Calendar}, just get the unix timestamp as
* <code>long</code> using {@link Date#getTime} or {@link Calendar#getTimeInMillis} and
- * index this as a numeric value with {@link LongField}
- * and use {@link NumericRangeQuery} to query it.
+ * index this as a numeric value with {@link DimensionalLongField}
+ * and use {@link DimensionalRangeQuery} to query it.
*/
public class DateTools {
Copied: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalBinaryField.java (from r1718974, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalField.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalBinaryField.java?p2=lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalBinaryField.java&p1=lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalField.java&r1=1718974&r2=1719562&rev=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalField.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalBinaryField.java Fri Dec 11 21:13:41 2015
@@ -18,15 +18,13 @@ package org.apache.lucene.document;
*/
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.RamUsageEstimator;
-import org.apache.lucene.util.bkd.BKDUtil;
-/** A field that is indexed dimensionally such that finding
- * all documents within an N-dimensional at search time is
+/** A binary field that is indexed dimensionally such that finding
+ * all documents within an N-dimensional shape or range at search time is
* efficient. Muliple values for the same field in one documents
* is allowed. */
-public final class DimensionalField extends Field {
+public final class DimensionalBinaryField extends Field {
private static FieldType getType(byte[][] point) {
if (point == null) {
@@ -91,22 +89,6 @@ public final class DimensionalField exte
return new BytesRef(packed);
}
- private static BytesRef pack(long... point) {
- if (point == null) {
- throw new IllegalArgumentException("point cannot be null");
- }
- if (point.length == 0) {
- throw new IllegalArgumentException("point cannot be 0 dimensions");
- }
- byte[] packed = new byte[point.length * RamUsageEstimator.NUM_BYTES_LONG];
-
- for(int dim=0;dim<point.length;dim++) {
- BKDUtil.longToBytes(point[dim], packed, dim);
- }
-
- return new BytesRef(packed);
- }
-
/** General purpose API: creates a new DimensionalField, indexing the
* provided N-dimensional binary point.
*
@@ -114,23 +96,12 @@ public final class DimensionalField exte
* @param point byte[][] value
* @throws IllegalArgumentException if the field name or value is null.
*/
- public DimensionalField(String name, byte[]... point) {
+ public DimensionalBinaryField(String name, byte[]... point) {
super(name, pack(point), getType(point));
}
- /** General purpose API: creates a new DimensionalField, indexing the
- * provided N-dimensional long point.
- *
- * @param name field name
- * @param point long[] value
- * @throws IllegalArgumentException if the field name or value is null.
- */
- public DimensionalField(String name, long... point) {
- super(name, pack(point), getType(point.length, RamUsageEstimator.NUM_BYTES_LONG));
- }
-
/** Expert API */
- public DimensionalField(String name, byte[] packedPoint, FieldType type) {
+ public DimensionalBinaryField(String name, byte[] packedPoint, FieldType type) {
super(name, packedPoint, type);
if (packedPoint.length != type.dimensionCount() * type.dimensionNumBytes()) {
throw new IllegalArgumentException("packedPoint is length=" + packedPoint.length + " but type.dimensionCount()=" + type.dimensionCount() + " and type.dimensionNumBytes()=" + type.dimensionNumBytes());
Added: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalDoubleField.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalDoubleField.java?rev=1719562&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalDoubleField.java (added)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalDoubleField.java Fri Dec 11 21:13:41 2015
@@ -0,0 +1,86 @@
+package org.apache.lucene.document;
+
+/*
+ * 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.
+ */
+
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.NumericUtils;
+import org.apache.lucene.util.RamUsageEstimator;
+
+/** A double field that is indexed dimensionally such that finding
+ * all documents within an N-dimensional shape or range at search time is
+ * efficient. Muliple values for the same field in one documents
+ * is allowed. */
+
+public final class DimensionalDoubleField extends Field {
+
+ private static FieldType getType(int numDims) {
+ FieldType type = new FieldType();
+ type.setDimensions(numDims, RamUsageEstimator.NUM_BYTES_LONG);
+ type.freeze();
+ return type;
+ }
+
+ @Override
+ public void setDoubleValue(double value) {
+ setDoubleValues(value);
+ }
+
+ /** Change the values of this field */
+ public void setDoubleValues(double... point) {
+ fieldsData = pack(point);
+ }
+
+ @Override
+ public void setBytesValue(BytesRef bytes) {
+ throw new IllegalArgumentException("cannot change value type from double to BytesRef");
+ }
+
+ @Override
+ public Number numericValue() {
+ BytesRef bytes = (BytesRef) fieldsData;
+ assert bytes.length == RamUsageEstimator.NUM_BYTES_LONG;
+ return NumericUtils.sortableLongToDouble(NumericUtils.bytesToLongDirect(bytes.bytes, bytes.offset));
+ }
+
+ private static BytesRef pack(double... point) {
+ if (point == null) {
+ throw new IllegalArgumentException("point cannot be null");
+ }
+ if (point.length == 0) {
+ throw new IllegalArgumentException("point cannot be 0 dimensions");
+ }
+ byte[] packed = new byte[point.length * RamUsageEstimator.NUM_BYTES_LONG];
+
+ for(int dim=0;dim<point.length;dim++) {
+ NumericUtils.longToBytesDirect(NumericUtils.doubleToSortableLong(point[dim]), packed, dim);
+ }
+
+ return new BytesRef(packed);
+ }
+
+ /** Creates a new DimensionalDoubleField, indexing the
+ * provided N-dimensional int point.
+ *
+ * @param name field name
+ * @param point double[] value
+ * @throws IllegalArgumentException if the field name or value is null.
+ */
+ public DimensionalDoubleField(String name, double... point) {
+ super(name, pack(point), getType(point.length));
+ }
+}
Added: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalFloatField.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalFloatField.java?rev=1719562&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalFloatField.java (added)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalFloatField.java Fri Dec 11 21:13:41 2015
@@ -0,0 +1,86 @@
+package org.apache.lucene.document;
+
+/*
+ * 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.
+ */
+
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.NumericUtils;
+import org.apache.lucene.util.RamUsageEstimator;
+
+/** A field that is indexed dimensionally such that finding
+ * all documents within an N-dimensional at search time is
+ * efficient. Muliple values for the same field in one documents
+ * is allowed. */
+
+public final class DimensionalFloatField extends Field {
+
+ private static FieldType getType(int numDims) {
+ FieldType type = new FieldType();
+ type.setDimensions(numDims, RamUsageEstimator.NUM_BYTES_INT);
+ type.freeze();
+ return type;
+ }
+
+ @Override
+ public void setFloatValue(float value) {
+ setFloatValues(value);
+ }
+
+ /** Change the values of this field */
+ public void setFloatValues(float... point) {
+ fieldsData = pack(point);
+ }
+
+ @Override
+ public void setBytesValue(BytesRef bytes) {
+ throw new IllegalArgumentException("cannot change value type from float to BytesRef");
+ }
+
+ @Override
+ public Number numericValue() {
+ BytesRef bytes = (BytesRef) fieldsData;
+ assert bytes.length == RamUsageEstimator.NUM_BYTES_INT;
+ return NumericUtils.sortableIntToFloat(NumericUtils.bytesToIntDirect(bytes.bytes, bytes.offset));
+ }
+
+ private static BytesRef pack(float... point) {
+ if (point == null) {
+ throw new IllegalArgumentException("point cannot be null");
+ }
+ if (point.length == 0) {
+ throw new IllegalArgumentException("point cannot be 0 dimensions");
+ }
+ byte[] packed = new byte[point.length * RamUsageEstimator.NUM_BYTES_INT];
+
+ for(int dim=0;dim<point.length;dim++) {
+ NumericUtils.intToBytesDirect(NumericUtils.floatToSortableInt(point[dim]), packed, dim);
+ }
+
+ return new BytesRef(packed);
+ }
+
+ /** Creates a new DimensionalFloatField, indexing the
+ * provided N-dimensional float point.
+ *
+ * @param name field name
+ * @param point int[] value
+ * @throws IllegalArgumentException if the field name or value is null.
+ */
+ public DimensionalFloatField(String name, float... point) {
+ super(name, pack(point), getType(point.length));
+ }
+}
Added: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalIntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalIntField.java?rev=1719562&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalIntField.java (added)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalIntField.java Fri Dec 11 21:13:41 2015
@@ -0,0 +1,86 @@
+package org.apache.lucene.document;
+
+/*
+ * 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.
+ */
+
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.NumericUtils;
+import org.apache.lucene.util.RamUsageEstimator;
+
+/** An int field that is indexed dimensionally such that finding
+ * all documents within an N-dimensional shape or range at search time is
+ * efficient. Muliple values for the same field in one documents
+ * is allowed. */
+
+public final class DimensionalIntField extends Field {
+
+ private static FieldType getType(int numDims) {
+ FieldType type = new FieldType();
+ type.setDimensions(numDims, RamUsageEstimator.NUM_BYTES_INT);
+ type.freeze();
+ return type;
+ }
+
+ @Override
+ public void setIntValue(int value) {
+ setIntValues(value);
+ }
+
+ /** Change the values of this field */
+ public void setIntValues(int... point) {
+ fieldsData = pack(point);
+ }
+
+ @Override
+ public void setBytesValue(BytesRef bytes) {
+ throw new IllegalArgumentException("cannot change value type from int to BytesRef");
+ }
+
+ @Override
+ public Number numericValue() {
+ BytesRef bytes = (BytesRef) fieldsData;
+ assert bytes.length == RamUsageEstimator.NUM_BYTES_INT;
+ return NumericUtils.bytesToInt(bytes.bytes, bytes.offset);
+ }
+
+ private static BytesRef pack(int... point) {
+ if (point == null) {
+ throw new IllegalArgumentException("point cannot be null");
+ }
+ if (point.length == 0) {
+ throw new IllegalArgumentException("point cannot be 0 dimensions");
+ }
+ byte[] packed = new byte[point.length * RamUsageEstimator.NUM_BYTES_INT];
+
+ for(int dim=0;dim<point.length;dim++) {
+ NumericUtils.intToBytes(point[dim], packed, dim);
+ }
+
+ return new BytesRef(packed);
+ }
+
+ /** Creates a new DimensionalIntField, indexing the
+ * provided N-dimensional int point.
+ *
+ * @param name field name
+ * @param point int[] value
+ * @throws IllegalArgumentException if the field name or value is null.
+ */
+ public DimensionalIntField(String name, int... point) {
+ super(name, pack(point), getType(point.length));
+ }
+}
Added: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalLongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalLongField.java?rev=1719562&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalLongField.java (added)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DimensionalLongField.java Fri Dec 11 21:13:41 2015
@@ -0,0 +1,86 @@
+package org.apache.lucene.document;
+
+/*
+ * 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.
+ */
+
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.NumericUtils;
+import org.apache.lucene.util.RamUsageEstimator;
+
+/** A long field that is indexed dimensionally such that finding
+ * all documents within an N-dimensional shape or range at search time is
+ * efficient. Muliple values for the same field in one documents
+ * is allowed. */
+
+public final class DimensionalLongField extends Field {
+
+ private static FieldType getType(int numDims) {
+ FieldType type = new FieldType();
+ type.setDimensions(numDims, RamUsageEstimator.NUM_BYTES_LONG);
+ type.freeze();
+ return type;
+ }
+
+ @Override
+ public void setLongValue(long value) {
+ setLongValues(value);
+ }
+
+ /** Change the values of this field */
+ public void setLongValues(long... point) {
+ fieldsData = pack(point);
+ }
+
+ @Override
+ public void setBytesValue(BytesRef bytes) {
+ throw new IllegalArgumentException("cannot change value type from long to BytesRef");
+ }
+
+ @Override
+ public Number numericValue() {
+ BytesRef bytes = (BytesRef) fieldsData;
+ assert bytes.length == RamUsageEstimator.NUM_BYTES_LONG;
+ return NumericUtils.bytesToLong(bytes.bytes, bytes.offset);
+ }
+
+ private static BytesRef pack(long... point) {
+ if (point == null) {
+ throw new IllegalArgumentException("point cannot be null");
+ }
+ if (point.length == 0) {
+ throw new IllegalArgumentException("point cannot be 0 dimensions");
+ }
+ byte[] packed = new byte[point.length * RamUsageEstimator.NUM_BYTES_LONG];
+
+ for(int dim=0;dim<point.length;dim++) {
+ NumericUtils.longToBytes(point[dim], packed, dim);
+ }
+
+ return new BytesRef(packed);
+ }
+
+ /** Creates a new DimensionalLongField, indexing the
+ * provided N-dimensional int point.
+ *
+ * @param name field name
+ * @param point int[] value
+ * @throws IllegalArgumentException if the field name or value is null.
+ */
+ public DimensionalLongField(String name, long... point) {
+ super(name, pack(point), getType(point.length));
+ }
+}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/Document.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/Document.java?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/Document.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/Document.java Fri Dec 11 21:13:41 2015
@@ -229,8 +229,8 @@ public final class Document implements I
* Returns an array of values of the field specified as the method parameter.
* This method returns an empty array when there are no
* matching fields. It never returns null.
- * For {@link IntField}, {@link LongField}, {@link
- * FloatField} and {@link DoubleField} it returns the string value of the number. If you want
+ * For {@link LegacyIntField}, {@link LegacyLongField}, {@link
+ * LegacyFloatField} and {@link LegacyDoubleField} it returns the string value of the number. If you want
* the actual numeric field instances back, use {@link #getFields}.
* @param name the name of the field
* @return a <code>String[]</code> of field values
@@ -256,8 +256,8 @@ public final class Document implements I
* this document, or null. If multiple fields exist with this name, this
* method returns the first value added. If only binary fields with this name
* exist, returns null.
- * For {@link IntField}, {@link LongField}, {@link
- * FloatField} and {@link DoubleField} it returns the string value of the number. If you want
+ * For {@link LegacyIntField}, {@link LegacyLongField}, {@link
+ * LegacyFloatField} and {@link LegacyDoubleField} it returns the string value of the number. If you want
* the actual numeric field instance back, use {@link #getField}.
*/
public final String get(String name) {
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/Field.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/Field.java?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/Field.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/Field.java Fri Dec 11 21:13:41 2015
@@ -21,12 +21,11 @@ import java.io.IOException;
import java.io.Reader;
import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.NumericTokenStream;
+import org.apache.lucene.analysis.LegacyNumericTokenStream;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.BytesTermAttribute;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
-import org.apache.lucene.document.FieldType.NumericType;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.IndexableFieldType;
@@ -36,8 +35,8 @@ import org.apache.lucene.util.BytesRef;
/**
* Expert: directly create a field for a document. Most
* users should use one of the sugar subclasses: {@link
- * IntField}, {@link LongField}, {@link FloatField}, {@link
- * DoubleField}, {@link BinaryDocValuesField}, {@link
+ * LegacyIntField}, {@link LegacyLongField}, {@link LegacyFloatField}, {@link
+ * LegacyDoubleField}, {@link BinaryDocValuesField}, {@link
* NumericDocValuesField}, {@link SortedDocValuesField}, {@link
* StringField}, {@link TextField}, {@link StoredField}.
*
@@ -504,14 +503,14 @@ public class Field implements IndexableF
return null;
}
- final NumericType numericType = fieldType().numericType();
+ final FieldType.LegacyNumericType numericType = fieldType().numericType();
if (numericType != null) {
- if (!(reuse instanceof NumericTokenStream && ((NumericTokenStream)reuse).getPrecisionStep() == type.numericPrecisionStep())) {
+ if (!(reuse instanceof LegacyNumericTokenStream && ((LegacyNumericTokenStream)reuse).getPrecisionStep() == type.numericPrecisionStep())) {
// lazy init the TokenStream as it is heavy to instantiate
// (attributes,...) if not needed (stored field loading)
- reuse = new NumericTokenStream(type.numericPrecisionStep());
+ reuse = new LegacyNumericTokenStream(type.numericPrecisionStep());
}
- final NumericTokenStream nts = (NumericTokenStream) reuse;
+ final LegacyNumericTokenStream nts = (LegacyNumericTokenStream) reuse;
// initialize value in TokenStream
final Number val = (Number) fieldsData;
switch (numericType) {
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/FieldType.java?rev=1719562&r1=1719561&r2=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/FieldType.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/FieldType.java Fri Dec 11 21:13:41 2015
@@ -21,8 +21,7 @@ import org.apache.lucene.analysis.Analyz
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexableFieldType;
-import org.apache.lucene.search.NumericRangeQuery; // javadocs
-import org.apache.lucene.util.NumericUtils;
+import org.apache.lucene.util.LegacyNumericUtils;
/**
* Describes the properties of a field.
@@ -32,7 +31,7 @@ public class FieldType implements Indexa
/** Data type of the numeric value
* @since 3.2
*/
- public enum NumericType {
+ public enum LegacyNumericType {
/** 32-bit integer numeric type */
INT,
/** 64-bit long numeric type */
@@ -51,9 +50,9 @@ public class FieldType implements Indexa
private boolean storeTermVectorPayloads;
private boolean omitNorms;
private IndexOptions indexOptions = IndexOptions.NONE;
- private NumericType numericType;
+ private LegacyNumericType numericType;
private boolean frozen;
- private int numericPrecisionStep = NumericUtils.PRECISION_STEP_DEFAULT;
+ private int numericPrecisionStep = LegacyNumericUtils.PRECISION_STEP_DEFAULT;
private DocValuesType docValuesType = DocValuesType.NONE;
private int dimensionCount;
private int dimensionNumBytes;
@@ -301,20 +300,20 @@ public class FieldType implements Indexa
* future modifications.
* @see #numericType()
*/
- public void setNumericType(NumericType type) {
+ public void setNumericType(LegacyNumericType type) {
checkIfFrozen();
numericType = type;
}
/**
- * NumericType: if non-null then the field's value will be indexed
- * numerically so that {@link NumericRangeQuery} can be used at
+ * LegacyNumericType: if non-null then the field's value will be indexed
+ * numerically so that {@link org.apache.lucene.search.LegacyNumericRangeQuery} can be used at
* search time.
* <p>
* The default is <code>null</code> (no numeric type)
- * @see #setNumericType(NumericType)
+ * @see #setNumericType(org.apache.lucene.document.FieldType.LegacyNumericType)
*/
- public NumericType numericType() {
+ public LegacyNumericType numericType() {
return numericType;
}
@@ -339,7 +338,7 @@ public class FieldType implements Indexa
* <p>
* This has no effect if {@link #numericType()} returns null.
* <p>
- * The default is {@link NumericUtils#PRECISION_STEP_DEFAULT}
+ * The default is {@link org.apache.lucene.util.LegacyNumericUtils#PRECISION_STEP_DEFAULT}
* @see #setNumericPrecisionStep(int)
*/
public int numericPrecisionStep() {
Copied: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/LegacyDoubleField.java (from r1718974, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DoubleField.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/LegacyDoubleField.java?p2=lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/LegacyDoubleField.java&p1=lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DoubleField.java&r1=1718974&r2=1719562&rev=1719562&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/DoubleField.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/document/LegacyDoubleField.java Fri Dec 11 21:13:41 2015
@@ -17,10 +17,8 @@ package org.apache.lucene.document;
* limitations under the License.
*/
-import org.apache.lucene.analysis.NumericTokenStream; // javadocs
import org.apache.lucene.index.IndexOptions;
-import org.apache.lucene.search.NumericRangeQuery; // javadocs
-import org.apache.lucene.util.NumericUtils;
+
/**
* <p>
@@ -28,14 +26,14 @@ import org.apache.lucene.util.NumericUti
* for efficient range filtering and sorting. Here's an example usage:
*
* <pre class="prettyprint">
- * document.add(new DoubleField(name, 6.0, Field.Store.NO));
+ * document.add(new LegacyDoubleField(name, 6.0, Field.Store.NO));
* </pre>
*
- * For optimal performance, re-use the <code>DoubleField</code> and
+ * For optimal performance, re-use the <code>LegacyDoubleField</code> and
* {@link Document} instance for more than one document:
*
* <pre class="prettyprint">
- * DoubleField field = new DoubleField(name, 0.0, Field.Store.NO);
+ * LegacyDoubleField field = new LegacyDoubleField(name, 0.0, Field.Store.NO);
* Document document = new Document();
* document.add(field);
*
@@ -47,24 +45,24 @@ import org.apache.lucene.util.NumericUti
* }
* </pre>
*
- * See also {@link IntField}, {@link LongField}, {@link
- * FloatField}.
+ * See also {@link LegacyIntField}, {@link LegacyLongField}, {@link
+ * LegacyFloatField}.
*
* <p>To perform range querying or filtering against a
- * <code>DoubleField</code>, use {@link NumericRangeQuery}.
+ * <code>LegacyDoubleField</code>, use {@link org.apache.lucene.search.LegacyNumericRangeQuery}.
* To sort according to a
- * <code>DoubleField</code>, use the normal numeric sort types, eg
- * {@link org.apache.lucene.search.SortField.Type#DOUBLE}. <code>DoubleField</code>
+ * <code>LegacyDoubleField</code>, use the normal numeric sort types, eg
+ * {@link org.apache.lucene.search.SortField.Type#DOUBLE}. <code>LegacyDoubleField</code>
* values can also be loaded directly from {@link org.apache.lucene.index.LeafReader#getNumericDocValues}.</p>
*
- * <p>You may add the same field name as an <code>DoubleField</code> to
+ * <p>You may add the same field name as an <code>LegacyDoubleField</code> to
* the same document more than once. Range querying and
* filtering will be the logical OR of all values; so a range query
* will hit all documents that have at least one value in
* the range. However sort behavior is not defined. If you need to sort,
- * you should separately index a single-valued <code>DoubleField</code>.</p>
+ * you should separately index a single-valued <code>LegacyDoubleField</code>.</p>
*
- * <p>A <code>DoubleField</code> will consume somewhat more disk space
+ * <p>A <code>LegacyDoubleField</code> will consume somewhat more disk space
* in the index than an ordinary single-valued field.
* However, for a typical index that includes substantial
* textual content per document, this increase will likely
@@ -85,7 +83,7 @@ import org.apache.lucene.util.NumericUti
* FieldType#setNumericPrecisionStep} method if you'd
* like to change the value. Note that you must also
* specify a congruent value when creating {@link
- * NumericRangeQuery}.
+ * org.apache.lucene.search.LegacyNumericRangeQuery}.
* For low cardinality fields larger precision steps are good.
* If the cardinality is < 100, it is fair
* to use {@link Integer#MAX_VALUE}, which produces one
@@ -93,9 +91,9 @@ import org.apache.lucene.util.NumericUti
*
* <p>For more information on the internals of numeric trie
* indexing, including the <a
- * href="../search/NumericRangeQuery.html#precisionStepDesc"><code>precisionStep</code></a>
- * configuration, see {@link NumericRangeQuery}. The format of
- * indexed values is described in {@link NumericUtils}.
+ * href="../search/LegacyNumericRangeQuery.html#precisionStepDesc"><code>precisionStep</code></a>
+ * configuration, see {@link org.apache.lucene.search.LegacyNumericRangeQuery}. The format of
+ * indexed values is described in {@link org.apache.lucene.util.LegacyNumericUtils}.
*
* <p>If you only need to sort by numeric value, and never
* run range querying/filtering, you can index using a
@@ -103,17 +101,20 @@ import org.apache.lucene.util.NumericUti
* This will minimize disk space consumed. </p>
*
* <p>More advanced users can instead use {@link
- * NumericTokenStream} directly, when indexing numbers. This
+ * org.apache.lucene.analysis.LegacyNumericTokenStream} directly, when indexing numbers. This
* class is a wrapper around this token stream type for
* easier, more intuitive usage.</p>
*
+ * @deprecated Please use {@link DimensionalDoubleField} instead
+ *
* @since 2.9
*/
-public final class DoubleField extends Field {
+@Deprecated
+public final class LegacyDoubleField extends Field {
/**
- * Type for a DoubleField that is not stored:
+ * Type for a LegacyDoubleField that is not stored:
* normalization factors, frequencies, and positions are omitted.
*/
public static final FieldType TYPE_NOT_STORED = new FieldType();
@@ -121,12 +122,12 @@ public final class DoubleField extends F
TYPE_NOT_STORED.setTokenized(true);
TYPE_NOT_STORED.setOmitNorms(true);
TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS);
- TYPE_NOT_STORED.setNumericType(FieldType.NumericType.DOUBLE);
+ TYPE_NOT_STORED.setNumericType(FieldType.LegacyNumericType.DOUBLE);
TYPE_NOT_STORED.freeze();
}
/**
- * Type for a stored DoubleField:
+ * Type for a stored LegacyDoubleField:
* normalization factors, frequencies, and positions are omitted.
*/
public static final FieldType TYPE_STORED = new FieldType();
@@ -134,20 +135,20 @@ public final class DoubleField extends F
TYPE_STORED.setTokenized(true);
TYPE_STORED.setOmitNorms(true);
TYPE_STORED.setIndexOptions(IndexOptions.DOCS);
- TYPE_STORED.setNumericType(FieldType.NumericType.DOUBLE);
+ TYPE_STORED.setNumericType(FieldType.LegacyNumericType.DOUBLE);
TYPE_STORED.setStored(true);
TYPE_STORED.freeze();
}
- /** Creates a stored or un-stored DoubleField with the provided value
+ /** Creates a stored or un-stored LegacyDoubleField with the provided value
* and default <code>precisionStep</code> {@link
- * NumericUtils#PRECISION_STEP_DEFAULT} (16).
+ * org.apache.lucene.util.LegacyNumericUtils#PRECISION_STEP_DEFAULT} (16).
* @param name field name
* @param value 64-bit double value
* @param stored Store.YES if the content should also be stored
* @throws IllegalArgumentException if the field name is null.
*/
- public DoubleField(String name, double value, Store stored) {
+ public LegacyDoubleField(String name, double value, Store stored) {
super(name, stored == Store.YES ? TYPE_STORED : TYPE_NOT_STORED);
fieldsData = Double.valueOf(value);
}
@@ -157,13 +158,13 @@ public final class DoubleField extends F
* @param name field name
* @param value 64-bit double value
* @param type customized field type: must have {@link FieldType#numericType()}
- * of {@link FieldType.NumericType#DOUBLE}.
+ * of {@link org.apache.lucene.document.FieldType.LegacyNumericType#DOUBLE}.
* @throws IllegalArgumentException if the field name or type is null, or
* if the field type does not have a DOUBLE numericType()
*/
- public DoubleField(String name, double value, FieldType type) {
+ public LegacyDoubleField(String name, double value, FieldType type) {
super(name, type);
- if (type.numericType() != FieldType.NumericType.DOUBLE) {
+ if (type.numericType() != FieldType.LegacyNumericType.DOUBLE) {
throw new IllegalArgumentException("type.numericType() must be DOUBLE but got " + type.numericType());
}
fieldsData = Double.valueOf(value);