You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by yo...@apache.org on 2009/08/04 21:06:33 UTC
svn commit: r800924 - in /lucene/solr/trunk: example/solr/conf/schema.xml
src/java/org/apache/solr/schema/TrieDateField.java
src/java/org/apache/solr/schema/TrieField.java
Author: yonik
Date: Tue Aug 4 19:06:33 2009
New Revision: 800924
URL: http://svn.apache.org/viewvc?rev=800924&view=rev
Log:
SOLR-1322: multiValued trie fields do work with NumericRangeQuery
Modified:
lucene/solr/trunk/example/solr/conf/schema.xml
lucene/solr/trunk/src/java/org/apache/solr/schema/TrieDateField.java
lucene/solr/trunk/src/java/org/apache/solr/schema/TrieField.java
Modified: lucene/solr/trunk/example/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/conf/schema.xml?rev=800924&r1=800923&r2=800924&view=diff
==============================================================================
--- lucene/solr/trunk/example/solr/conf/schema.xml (original)
+++ lucene/solr/trunk/example/solr/conf/schema.xml Tue Aug 4 19:06:33 2009
@@ -75,7 +75,7 @@
field first in an ascending sort and last in a descending sort.
-->
- <!-- Default numeric field types. For faster range queries, use the tint/tfloat/tlong/tdouble types.
+ <!-- Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types.
Note: the statistics component does not yet work with these field types.
-->
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
@@ -84,16 +84,14 @@
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<!--
- Numeric field types for single-valued fields that index extra tokens with
- lower precision to accelerate range queries when the number of values between
- the range endpoints is large. See the javadoc for NumericRangeQuery for
- internal implementation details.
-
- For single-valued fields, smaller precisionStep values (specified in bits)
- will lead to more tokens indexed per value, slightly higher index size, and
- faster range queries.
+ Numeric field types that index each value at various levels of precision
+ to accelerate range queries when the number of values between the range
+ endpoints is large. See the javadoc for NumericRangeQuery for internal
+ implementation details.
+
+ Smaller precisionStep values (specified in bits) will lead to more tokens
+ indexed per value, slightly larger index size, and faster range queries.
- Note: precisionStep is disabled for multiValued fields.
Note: faceting does not currently work for these fields.
-->
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
@@ -123,8 +121,8 @@
-->
<fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/>
- <!-- A Trie based single-valued date field for faster date range queries and date faceting -->
- <fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="8" positionIncrementGap="0"/>
+ <!-- A Trie based date field for faster date range queries and date faceting. -->
+ <fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/>
<!-- plain numeric field types that store and index the text
@@ -132,7 +130,7 @@
lexicographic ordering isn't equal to the numeric ordering)
These should only be used for compatibility with existing indexes.
Use Trie based fields instead.
- -->
+ -->
<fieldType name="pint" class="solr.IntField" omitNorms="true"/>
<fieldType name="plong" class="solr.LongField" omitNorms="true"/>
<fieldType name="pfloat" class="solr.FloatField" omitNorms="true"/>
@@ -143,7 +141,7 @@
<!--
These types should only be used for back compatibility with existing
indexes, or if "sortMissingLast" functionality is needed. Use Trie based fields instead.
- -->
+ -->
<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/TrieDateField.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/TrieDateField.java?rev=800924&r1=800923&r2=800924&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/TrieDateField.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/TrieDateField.java Tue Aug 4 19:06:33 2009
@@ -163,7 +163,7 @@
return null;
}
- int ps = field.multiValued() ? Integer.MAX_VALUE : precisionStep;
+ int ps = precisionStep;
byte[] arr=null;
TokenStream ts=null;
@@ -198,8 +198,7 @@
@Override
public Query getRangeQuery(QParser parser, SchemaField sf, Date min, Date max, boolean minInclusive, boolean maxInclusive) {
- // don't use a precisionStep if the field is multiValued
- int ps = sf.multiValued() ? Integer.MAX_VALUE : precisionStep;
+ int ps = precisionStep;
Query query = NumericRangeQuery.newLongRange(sf.getName(), ps,
min == null ? null : min.getTime(),
max == null ? null : max.getTime(),
Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/TrieField.java?rev=800924&r1=800923&r2=800924&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/TrieField.java Tue Aug 4 19:06:33 2009
@@ -223,9 +223,7 @@
@Override
public Query getRangeQuery(QParser parser, SchemaField field, String min, String max, boolean minInclusive, boolean maxInclusive) {
- // don't use a precisionStep if the field is multiValued
- int ps = field.multiValued() ? Integer.MAX_VALUE : precisionStep;
-
+ int ps = precisionStep;
Query query = null;
switch (type) {
case INTEGER:
@@ -405,7 +403,7 @@
return null;
}
- int ps = field.multiValued() ? Integer.MAX_VALUE : precisionStep;
+ int ps = precisionStep;
byte[] arr=null;
TokenStream ts=null;