lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r1067042 - in /lucene/dev/branches/branch_3x/solr: ./ src/java/org/apache/solr/schema/ src/java/org/apache/solr/search/ src/test-files/solr/conf/ src/test/org/apache/solr/ src/test/org/apache/solr/handler/ src/test/org/apache/solr/handler/c...
Date Fri, 04 Feb 2011 00:11:07 GMT
Author: hossman
Date: Fri Feb  4 00:11:06 2011
New Revision: 1067042

URL: http://svn.apache.org/viewvc?rev=1067042&view=rev
Log:
SOLR-2339: merge 1067030 from trunk

Modified:
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/CHANGES.txt
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/BoolField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/ByteField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/DoubleField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldType.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FloatField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/IntField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LongField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/SchemaField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/ShortField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TextField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieDateField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieField.java
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/QueryParsing.java
    lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema.xml
    lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema12.xml
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/BasicFunctionalityTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/ConvertedLegacyTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/TestDistributedSearch.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
    lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/function/SortByFunctionTest.java

Modified: lucene/dev/branches/branch_3x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/CHANGES.txt?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/solr/CHANGES.txt Fri Feb  4 00:11:06 2011
@@ -72,6 +72,15 @@ Upgrading from Solr 1.4
 
 * readercycle script was removed. (SOLR-2046)
 
+* In previous releases, sorting on fields that are "multiValued" 
+  (either by explicit declaration in schema.xml or by implict behavior
+  because the "version" attribute on the schema was less then 1.2) did 
+  not generally work, but it would sometimes silently act as if it
+  succeeded and order the docs arbitrarily.  Solr will now fail on any
+  attempt to sort on a multivalued field
+
+
+
 Detailed Change List
 ----------------------
 
@@ -506,6 +515,9 @@ Bug Fixes
   DocumentAnalysisRequestHandler to respect charset from XML file and only
   use HTTP header's "Content-Type" as a "hint". (Uwe Schindler)
 
+* SOLR-2339: Fix sorting to explicitly generate an error if you
+  attempt to sort on a multiValued field. (hossman)
+
 Other Changes
 ----------------------
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/BoolField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/BoolField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/BoolField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/BoolField.java Fri Feb  4 00:11:06 2011
@@ -41,6 +41,7 @@ public class BoolField extends FieldType
 
   @Override
   public SortField getSortField(SchemaField field,boolean reverse) {
+    field.checkSortability();
     return getStringSort(field,reverse);
   }
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/ByteField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/ByteField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/ByteField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/ByteField.java Fri Feb  4 00:11:06 2011
@@ -39,6 +39,7 @@ public class ByteField extends FieldType
   /////////////////////////////////////////////////////////////
   @Override
   public SortField getSortField(SchemaField field, boolean reverse) {
+    field.checkSortability();
     return new SortField(field.name, SortField.BYTE, reverse);
   }
 
@@ -82,4 +83,4 @@ public class ByteField extends FieldType
   public Byte toObject(Fieldable f) {
     return Byte.valueOf(toExternal(f));
   }
-}
\ No newline at end of file
+}

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/DoubleField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/DoubleField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/DoubleField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/DoubleField.java Fri Feb  4 00:11:06 2011
@@ -39,6 +39,7 @@ public class DoubleField extends FieldTy
   /////////////////////////////////////////////////////////////
   @Override
   public SortField getSortField(SchemaField field, boolean reverse) {
+    field.checkSortability();
     return new SortField(field.name, SortField.DOUBLE, reverse);
   }
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldType.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldType.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FieldType.java Fri Feb  4 00:11:06 2011
@@ -462,13 +462,17 @@ public abstract class FieldType extends 
   /**
    * Returns the SortField instance that should be used to sort fields
    * of this type.
+   * @see SchemaField#checkSortability
    */
   public abstract SortField getSortField(SchemaField field, boolean top);
 
   /**
-   * Utility usable by subclasses when they want to get basic String sorting.
+   * Utility usable by subclasses when they want to get basic String sorting 
+   * using common checks.
+   * @see SchemaField#checkSortability
    */
   protected SortField getStringSort(SchemaField field, boolean reverse) {
+    field.checkSortability();
     return Sorting.getStringSortField(field.name, reverse, field.sortMissingLast(),field.sortMissingFirst());
   }
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FloatField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FloatField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FloatField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/FloatField.java Fri Feb  4 00:11:06 2011
@@ -37,6 +37,7 @@ public class FloatField extends FieldTyp
 
   @Override
   public SortField getSortField(SchemaField field,boolean reverse) {
+    field.checkSortability();
     return new SortField(field.name,SortField.FLOAT, reverse);
   }
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/IntField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/IntField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/IntField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/IntField.java Fri Feb  4 00:11:06 2011
@@ -37,6 +37,7 @@ public class IntField extends FieldType 
 
   @Override
   public SortField getSortField(SchemaField field,boolean reverse) {
+    field.checkSortability();
     return new SortField(field.name,SortField.INT, reverse);
   }
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LongField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LongField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LongField.java Fri Feb  4 00:11:06 2011
@@ -39,7 +39,7 @@ public class LongField extends FieldType
 
   @Override
   public SortField getSortField(SchemaField field,boolean reverse) {
-
+    field.checkSortability();
     return new SortField(field.name,SortField.LONG, reverse);
   }
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/SchemaField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/SchemaField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/SchemaField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/SchemaField.java Fri Feb  4 00:11:06 2011
@@ -17,9 +17,12 @@
 
 package org.apache.solr.schema;
 
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.search.SortField;
+
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.response.XMLWriter;
 
@@ -126,10 +129,35 @@ public final class SchemaField extends F
     type.write(writer,name,val);
   }
 
+  /**
+   * Delegates to the FieldType for this field
+   * @see FieldType#getSortField
+   */
   public SortField getSortField(boolean top) {
     return type.getSortField(this, top);
   }
 
+  /** 
+   * Sanity checks that the properties of this field type are plausible 
+   * for a field that may be used in sorting, throwing an appropraite 
+   * exception (including hte field name) if it is not.  FieldType subclasses 
+   * can choose to call this method in their getSortField implementation
+   * @see FieldType#getSortField
+   */
+  public void checkSortability() throws SolrException {
+    if (! indexed() ) {
+      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, 
+                              "can not sort on unindexed field: " 
+                              + getName());
+    }
+    if ( multiValued() ) {
+      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, 
+                              "can not sort on multivalued field: " 
+                              + getName());
+    }
+    
+  }
+
 
   static SchemaField create(String name, FieldType ft, Map<String,String> props) {
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/ShortField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/ShortField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/ShortField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/ShortField.java Fri Feb  4 00:11:06 2011
@@ -42,7 +42,7 @@ public class ShortField extends FieldTyp
 
   @Override
   public SortField getSortField(SchemaField field, boolean reverse) {
-
+    field.checkSortability();
     return new SortField(field.name, SortField.SHORT, reverse);
   }
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TextField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TextField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TextField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TextField.java Fri Feb  4 00:11:06 2011
@@ -64,6 +64,7 @@ public class TextField extends FieldType
 
   @Override
   public SortField getSortField(SchemaField field, boolean reverse) {
+    /* :TODO: maybe warn if isTokenized(), but doesn't use LimitTokenCountFilter in it's chain? */
     return getStringSort(field, reverse);
   }
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieDateField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieDateField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieDateField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieDateField.java Fri Feb  4 00:11:06 2011
@@ -70,6 +70,7 @@ public class TrieDateField extends DateF
 
   @Override
   public SortField getSortField(SchemaField field, boolean top) {
+    field.checkSortability();
     return new SortField(field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER, top);
   }
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieField.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/TrieField.java Fri Feb  4 00:11:06 2011
@@ -114,6 +114,8 @@ public class TrieField extends FieldType
 
   @Override
   public SortField getSortField(SchemaField field, boolean top) {
+    field.checkSortability();
+
     switch (type) {
       case INTEGER:
         return new SortField(field.getName(), FieldCache.NUMERIC_UTILS_INT_PARSER, top);

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/QueryParsing.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/QueryParsing.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/QueryParsing.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/QueryParsing.java Fri Feb  4 00:11:06 2011
@@ -377,16 +377,9 @@ public class QueryParsing {
             }
             throw new SolrException
               (SolrException.ErrorCode.BAD_REQUEST,
-               "sort param fiedl can't be found: " + field);
+               "sort param field can't be found: " + field);
           }
-              
-          // TODO: remove this - it should be up to the FieldType
-          if (!sf.indexed()) {
-            throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, 
-                                    "can not sort on unindexed field: " 
-                                    + field);
-          }
-          lst.add(sf.getType().getSortField(sf, top));
+          lst.add(sf.getSortField(top));
         }
       }
 

Modified: lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema.xml?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema.xml (original)
+++ lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema.xml Fri Feb  4 00:11:06 2011
@@ -401,8 +401,8 @@
    <field name="text" type="text" indexed="true" stored="false"/>
    <field name="subject" type="text" indexed="true" stored="true"/>
    <field name="title" type="nametext" indexed="true" stored="true"/>
-   <field name="weight" type="float" indexed="true" stored="true"/>
-   <field name="bday" type="date" indexed="true" stored="true"/>
+   <field name="weight" type="float" indexed="true" stored="true" multiValued="false"/>
+   <field name="bday" type="date" indexed="true" stored="true" multiValued="false"/>
 
    <field name="title_stemmed" type="text" indexed="true" stored="false"/>
    <field name="title_lettertok" type="lettertok" indexed="true" stored="false"/>
@@ -479,7 +479,7 @@
 
    <field name="numberpartfail" type="failtype1" indexed="true" stored="true"/>
 
-   <field name="nullfirst" type="string" indexed="true" stored="true" sortMissingFirst="true"/>
+   <field name="nullfirst" type="string" indexed="true" stored="true" sortMissingFirst="true" multiValued="false"/>
 
    <field name="subword" type="subword" indexed="true" stored="true"/>
    <field name="subword_offsets" type="subword" indexed="true" stored="true" termOffsets="true"/>
@@ -507,27 +507,40 @@
         both match, the first appearing in the schema will be used.
    -->
    <dynamicField name="*_i"  type="int"    indexed="true"  stored="true"/>
+   <dynamicField name="*_i1"  type="int"    indexed="true" stored="true" multiValued="false"/>
+                 
    <dynamicField name="*_s"  type="string"  indexed="true"  stored="true"/>
    <dynamicField name="*_s1"  type="string"  indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_l"  type="long"   indexed="true"  stored="true"/>
+   <dynamicField name="*_l1"  type="long"   indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_t"  type="text"    indexed="true"  stored="true"/>
    <dynamicField name="*_b"  type="boolean" indexed="true"  stored="true"/>
    <dynamicField name="*_f"  type="float"  indexed="true"  stored="true"/>
+   <dynamicField name="*_f1"  type="float"  indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_d"  type="double" indexed="true"  stored="true"/>
+   <dynamicField name="*_d1"  type="double" indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_dt" type="date"    indexed="true"  stored="true"/>
+   <dynamicField name="*_dt1" type="date"    indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_bcd" type="bcdstr" indexed="true"  stored="true"/>
 
       <!-- some trie-coded dynamic fields for faster range queries -->
    <dynamicField name="*_ti" type="tint"    indexed="true"  stored="true"/>
+   <dynamicField name="*_ti1" type="tint"    indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_tl" type="tlong"   indexed="true"  stored="true"/>
+   <dynamicField name="*_tl1" type="tlong"   indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_tf" type="tfloat"  indexed="true"  stored="true"/>
+   <dynamicField name="*_tf1" type="tfloat"  indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_td" type="tdouble" indexed="true"  stored="true"/>
+   <dynamicField name="*_td1" type="tdouble" indexed="true" stored="true" multiValued="false"/>
    <dynamicField name="*_tdt" type="tdate"  indexed="true"  stored="true"/>
+   <dynamicField name="*_tdt1" type="tdate"  indexed="true"  stored="true" multiValued="false"/>
 
-   <dynamicField name="*_si"  type="sint"  indexed="true"  stored="true"/>
+   <dynamicField name="*_si"  type="sint"  indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_sl"  type="slong"  indexed="true"  stored="true"/>
    <dynamicField name="*_sf"  type="sfloat"  indexed="true"  stored="true"/>
+   <dynamicField name="*_sf1"  type="sfloat"  indexed="true"  stored="true" multiValued="false"/>
    <dynamicField name="*_sd"  type="sdouble"  indexed="true"  stored="true"/>
+   <dynamicField name="*_sd1"  type="sdouble"  indexed="true"  stored="true" multiValued="false"/>
 
    <dynamicField name="*_pi"  type="pint"    indexed="true"  stored="true"/>
    <dynamicField name="*_pf"  type="pfloat"  indexed="true"  stored="true"/>

Modified: lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema12.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema12.xml?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema12.xml (original)
+++ lucene/dev/branches/branch_3x/solr/src/test-files/solr/conf/schema12.xml Fri Feb  4 00:11:06 2011
@@ -543,6 +543,8 @@
    <dynamicField name="*_sw" type="text_sw" indexed="true" stored="true" multiValued="true"/>
 
    <dynamicField name="*_i"  type="int"    indexed="true"  stored="true"/>
+   <dynamicField name="*_s1"  type="string"  indexed="true" stored="true" multiValued="false"/>
+   <!-- :TODO: why are these identical?!?!?! -->
    <dynamicField name="*_s"  type="string"  indexed="true"  stored="true" multiValued="true"/>
    <dynamicField name="*_ss"  type="string"  indexed="true"  stored="true" multiValued="true"/>
    <dynamicField name="*_l"  type="long"   indexed="true"  stored="true"/>

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/BaseDistributedSearchTestCase.java Fri Feb  4 00:11:06 2011
@@ -120,7 +120,7 @@ public abstract class BaseDistributedSea
    */
   public abstract void doTest() throws Exception;
 
-  public static String[] fieldNames = new String[]{"n_ti", "n_f", "n_tf", "n_d", "n_td", "n_l", "n_tl", "n_dt", "n_tdt"};
+  public static String[] fieldNames = new String[]{"n_ti1", "n_f1", "n_tf1", "n_d1", "n_td1", "n_l1", "n_tl1", "n_dt1", "n_tdt1"};
   public static RandVal[] randVals = new RandVal[]{rint, rfloat, rfloat, rdouble, rdouble, rlong, rlong, rdate, rdate};
 
   protected String[] getFieldNames() {
@@ -521,7 +521,8 @@ public abstract class BaseDistributedSea
     String cmp;
     cmp = compare(a.getResponse(), b.getResponse(), flags, handle);
     if (cmp != null) {
-      log.info("Mismatched responses:\n" + a + "\n" + b);
+      //log.info("Mismatched responses:\n" + a + "\n" + b);
+      System.err.println("Mismatched responses:\n" + a + "\n" + b); // :nocommit:
       TestCase.fail(cmp);
     }
   }

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/BasicFunctionalityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/BasicFunctionalityTest.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/BasicFunctionalityTest.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/BasicFunctionalityTest.java Fri Feb  4 00:11:06 2011
@@ -30,6 +30,9 @@ import org.apache.lucene.document.Field;
 import org.apache.lucene.index.LogMergePolicy;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.Query;
+
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.params.AppendedSolrParams;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.DefaultSolrParams;
@@ -49,6 +52,8 @@ import org.apache.solr.search.DocIterato
 import org.apache.solr.search.DocList;
 import org.apache.solr.search.QueryParsing;
 import org.apache.solr.update.SolrIndexWriter;
+
+
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -670,6 +675,39 @@ public class BasicFunctionalityTest exte
             "*[count(//doc)=1]");
   }
 
+  @Test
+  public void testAbuseOfSort() {
+
+    assertU(adoc("id", "9999991",
+                 "sortabuse_b", "true",
+                 "sortabuse_t", "zzz xxx ccc vvv bbb nnn aaa sss ddd fff ggg"));
+    assertU(adoc("id", "9999992",
+                 "sortabuse_b", "true",
+                 "sortabuse_t", "zzz xxx ccc vvv bbb nnn qqq www eee rrr ttt"));
+
+    assertU(commit());
+  
+    try {
+      assertQ("sort on something that shouldn't work",
+              req("q", "sortabuse_b:true",
+                  "sort", "sortabuse_t asc"),
+              "*[count(//doc)=2]");
+      fail("no error encountered when sorting on sortabuse_t");
+    } catch (Exception outer) {
+      // EXPECTED
+      Throwable root = getRootCause(outer);
+      assertEquals("sort exception root cause", 
+                   SolrException.class, root.getClass());
+      SolrException e = (SolrException) root;
+      assertEquals("incorrect error type", 
+                   SolrException.ErrorCode.BAD_REQUEST,
+                   SolrException.ErrorCode.getErrorCode(e.code()));
+      assertTrue("exception doesn't contain field name",
+                 -1 != e.getMessage().indexOf("sortabuse_t"));
+    }
+  }
+
+
 //   /** this doesn't work, but if it did, this is how we'd test it. */
 //   public void testOverwriteFalse() {
 

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/ConvertedLegacyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/ConvertedLegacyTest.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/ConvertedLegacyTest.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/ConvertedLegacyTest.java Fri Feb  4 00:11:06 2011
@@ -123,9 +123,9 @@ public class ConvertedLegacyTest extends
     // test range
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"val_s\">apple</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"val_s\">banana</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"val_s\">pear</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"val_s\">apple</field><field name=\"val_s1\">apple</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"val_s\">banana</field><field name=\"val_s1\">banana</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"val_s\">pear</field><field name=\"val_s1\">pear</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("val_s:[a TO z]")
             ,"//*[@numFound='3'] "
@@ -228,7 +228,7 @@ public class ConvertedLegacyTest extends
     args = new HashMap<String,String>();
     args.put("version","2.0");
     args.put("defType","lucenePlusSort");
-    req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s asc",
+    req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s1 asc",
                                     "standard", 0, 0 , args);
     assertQ(req
             ,"//*[@numFound='3'] "
@@ -237,7 +237,7 @@ public class ConvertedLegacyTest extends
     args = new HashMap<String,String>();
     args.put("version","2.0");
     args.put("defType","lucenePlusSort");
-    req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s desc",
+    req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s1 desc",
                                     "standard", 0, 0 , args);
     assertQ(req
             ,"//*[@numFound='3'] "
@@ -509,133 +509,133 @@ public class ConvertedLegacyTest extends
     // test integer ranges and sorting
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i\">1234567890</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i\">10</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i\">1</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i\">2</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i\">15</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i\">-1</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i\">-987654321</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i\">2147483647</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i\">-2147483648</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i\">0</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i1\">1234567890</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i1\">10</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i1\">1</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i1\">2</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i1\">15</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i1\">-1</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i1\">-987654321</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i1\">2147483647</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i1\">-2147483648</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_i1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id:44")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_i:2147483647")
+    assertQ(req("num_i1:2147483647")
             ,"//@numFound[.='1']  "
             ,"//int[.='2147483647']"
             );
-    assertQ(req("num_i:\"-2147483648\"")
+    assertQ(req("num_i1:\"-2147483648\"")
             ,"//@numFound[.='1'] "
             ,"//int[.='-2147483648']"
             );
-    assertQ(req("id:44;num_i asc;")
+    assertQ(req("id:44;num_i1 asc;")
             ,"//doc[1]/int[.='-2147483648'] "
             ,"//doc[last()]/int[.='2147483647']"
             );
-    assertQ(req("id:44;num_i desc;")
+    assertQ(req("id:44;num_i1 desc;")
             ,"//doc[1]/int[.='2147483647'] "
             ,"//doc[last()]/int[.='-2147483648']"
             );
-    assertQ(req("num_i:[0 TO 9]")
+    assertQ(req("num_i1:[0 TO 9]")
             ,"*[count(//doc)=3]"
             );
-    assertQ(req("num_i:[-2147483648 TO 2147483647]")
+    assertQ(req("num_i1:[-2147483648 TO 2147483647]")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_i:[-10 TO -1]")
+    assertQ(req("num_i1:[-10 TO -1]")
             ,"*[count(//doc)=1]"
             );
 
     // test long ranges and sorting
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l\">1234567890</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l\">10</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l\">1</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l\">2</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l\">15</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l\">-1</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l\">-987654321</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l\">9223372036854775807</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l\">-9223372036854775808</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l\">0</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l1\">1234567890</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l1\">10</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l1\">1</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l1\">2</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l1\">15</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l1\">-1</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l1\">-987654321</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l1\">9223372036854775807</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l1\">-9223372036854775808</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_l1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id:44")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_l:9223372036854775807")
+    assertQ(req("num_l1:9223372036854775807")
             ,"//@numFound[.='1'] "
             ,"//long[.='9223372036854775807']"
             );
-    assertQ(req("num_l:\"-9223372036854775808\"")
+    assertQ(req("num_l1:\"-9223372036854775808\"")
             ,"//@numFound[.='1'] "
             ,"//long[.='-9223372036854775808']"
             );
-    assertQ(req("id:44;num_l asc;")
+    assertQ(req("id:44;num_l1 asc;")
             ,"//doc[1]/long[.='-9223372036854775808'] "
             ,"//doc[last()]/long[.='9223372036854775807']"
             );
-    assertQ(req("id:44;num_l desc;")
+    assertQ(req("id:44;num_l1 desc;")
             ,"//doc[1]/long[.='9223372036854775807'] "
             ,"//doc[last()]/long[.='-9223372036854775808']"
             );
-    assertQ(req("num_l:[-1 TO 9]")
+    assertQ(req("num_l1:[-1 TO 9]")
             ,"*[count(//doc)=4]"
             );
-    assertQ(req("num_l:[-9223372036854775808 TO 9223372036854775807]")
+    assertQ(req("num_l1:[-9223372036854775808 TO 9223372036854775807]")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_l:[-10 TO -1]")
+    assertQ(req("num_l1:[-10 TO -1]")
             ,"*[count(//doc)=1]"
             );
 
     // test binary float ranges and sorting
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf\">1.4142135</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf\">Infinity</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf\">-Infinity</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf\">NaN</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf\">2</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf\">-1</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf\">-987654321</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf\">-999999.99</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf\">-1e20</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf\">0</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">1.4142135</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">Infinity</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">-Infinity</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">NaN</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">2</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">-1</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">-987654321</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">-999999.99</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">-1e20</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sf1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id:44")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_sf:Infinity")
+    assertQ(req("num_sf1:Infinity")
             ,"//@numFound[.='1']  "
             ,"//float[.='Infinity']"
             );
-    assertQ(req("num_sf:\"-Infinity\"")
+    assertQ(req("num_sf1:\"-Infinity\"")
             ,"//@numFound[.='1']  "
             ,"//float[.='-Infinity']"
             );
-    assertQ(req("num_sf:\"NaN\"")
+    assertQ(req("num_sf1:\"NaN\"")
             ,"//@numFound[.='1']  "
             ,"//float[.='NaN']"
             );
-    assertQ(req("num_sf:\"-1e20\"")
+    assertQ(req("num_sf1:\"-1e20\"")
             ,"//@numFound[.='1']"
             );
-    assertQ(req("id:44;num_sf asc;")
+    assertQ(req("id:44;num_sf1 asc;")
             ,"//doc[1]/float[.='-Infinity'] "
             ,"//doc[last()]/float[.='NaN']"
             );
-    assertQ(req("id:44;num_sf desc;")
+    assertQ(req("id:44;num_sf1 desc;")
             ,"//doc[1]/float[.='NaN'] "
             ,"//doc[last()]/float[.='-Infinity']"
             );
-    assertQ(req("num_sf:[-1 TO 2]")
+    assertQ(req("num_sf1:[-1 TO 2]")
             ,"*[count(//doc)=4]"
             );
-    assertQ(req("num_sf:[-Infinity TO Infinity]")
+    assertQ(req("num_sf1:[-Infinity TO Infinity]")
             ,"*[count(//doc)=9]"
             );
 
@@ -644,50 +644,50 @@ public class ConvertedLegacyTest extends
     // test binary double ranges and sorting
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd\">1.4142135</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd\">Infinity</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd\">-Infinity</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd\">NaN</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd\">2</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd\">-1</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd\">1e-100</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd\">-999999.99</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd\">-1e100</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd\">0</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">1.4142135</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">Infinity</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">-Infinity</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">NaN</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">2</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">-1</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">1e-100</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">-999999.99</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">-1e100</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"num_sd1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id:44")
             ,"*[count(//doc)=10]"
             );
-    assertQ(req("num_sd:Infinity")
+    assertQ(req("num_sd1:Infinity")
             ,"//@numFound[.='1']  "
             ,"//double[.='Infinity']"
             );
-    assertQ(req("num_sd:\"-Infinity\"")
+    assertQ(req("num_sd1:\"-Infinity\"")
             ,"//@numFound[.='1']  "
             ,"//double[.='-Infinity']"
             );
-    assertQ(req("num_sd:\"NaN\"")
+    assertQ(req("num_sd1:\"NaN\"")
             ,"//@numFound[.='1']  "
             ,"//double[.='NaN']"
             );
-    assertQ(req("num_sd:\"-1e100\"")
+    assertQ(req("num_sd1:\"-1e100\"")
             ,"//@numFound[.='1']"
             );
-    assertQ(req("num_sd:\"1e-100\"")
+    assertQ(req("num_sd1:\"1e-100\"")
             ,"//@numFound[.='1']"
             );
-    assertQ(req("id:44;num_sd asc;")
+    assertQ(req("id:44;num_sd1 asc;")
             ,"//doc[1]/double[.='-Infinity'] "
             ,"//doc[last()]/double[.='NaN']"
             );
-    assertQ(req("id:44;num_sd desc;")
+    assertQ(req("id:44;num_sd1 desc;")
             ,"//doc[1]/double[.='NaN'] "
             ,"//doc[last()]/double[.='-Infinity']"
             );
-    assertQ(req("num_sd:[-1 TO 2]")
+    assertQ(req("num_sd1:[-1 TO 2]")
             ,"*[count(//doc)=5]"
             );
-    assertQ(req("num_sd:[-Infinity TO Infinity]")
+    assertQ(req("num_sd1:[-Infinity TO Infinity]")
             ,"*[count(//doc)=9]"
             );
 
@@ -695,38 +695,38 @@ public class ConvertedLegacyTest extends
     // test sorting on multiple fields
 
     assertU("<delete><id>44</id></delete>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i\">10</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i\">1</field><field name=\"b_i\">100</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i\">-1</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i\">15</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i\">1</field><field name=\"b_i\">50</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i\">0</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i1\">10</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i1\">1</field><field name=\"b_i1\">100</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i1\">-1</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i1\">15</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i1\">1</field><field name=\"b_i1\">50</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id\">44</field><field name=\"a_i1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id:44")
             ,"*[count(//doc)=6]"
             );
 
-    assertQ(req("id:44; a_i asc,b_i desc")
+    assertQ(req("id:44; a_i1 asc,b_i1 desc")
             ,"*[count(//doc)=6] "
             ,"//doc[3]/int[.='100'] "
             ,"//doc[4]/int[.='50']"
             );
-    assertQ(req("id:44;a_i asc  , b_i asc;")
+    assertQ(req("id:44;a_i1 asc  , b_i1 asc;")
             ,"*[count(//doc)=6] "
             ,"//doc[3]/int[.='50'] "
             ,"//doc[4]/int[.='100']"
             );
-    assertQ(req("id:44;a_i asc;")
+    assertQ(req("id:44;a_i1 asc;")
             ,"*[count(//doc)=6] "
             ,"//doc[1]/int[.='-1'] "
             ,"//doc[last()]/int[.='15']"
             );
-    assertQ(req("id:44;a_i asc , score top;")
+    assertQ(req("id:44;a_i1 asc , score top;")
             ,"*[count(//doc)=6] "
             ,"//doc[1]/int[.='-1'] "
             ,"//doc[last()]/int[.='15']"
             );
-    assertQ(req("id:44; score top , a_i top, b_i bottom ;")
+    assertQ(req("id:44; score top , a_i1 top, b_i1 bottom ;")
             ,"*[count(//doc)=6] "
             ,"//doc[last()]/int[.='-1'] "
             ,"//doc[1]/int[.='15'] "
@@ -738,13 +738,13 @@ public class ConvertedLegacyTest extends
     // test sorting  with some docs missing the sort field
 
     assertU("<delete><query>id_i:[1000 TO 1010]</query></delete>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1000</field><field name=\"a_i\">1</field><field name=\"nullfirst\">Z</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1001</field><field name=\"a_i\">10</field><field name=\"nullfirst\">A</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1002</field><field name=\"a_i\">1</field><field name=\"b_si\">100</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1003</field><field name=\"a_i\">-1</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1004</field><field name=\"a_i\">15</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1005</field><field name=\"a_i\">1</field><field name=\"b_si\">50</field></doc></add>");
-    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1006</field><field name=\"a_i\">0</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1000</field><field name=\"a_i1\">1</field><field name=\"nullfirst\">Z</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1001</field><field name=\"a_i1\">10</field><field name=\"nullfirst\">A</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1002</field><field name=\"a_i1\">1</field><field name=\"b_si\">100</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1003</field><field name=\"a_i1\">-1</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1004</field><field name=\"a_i1\">15</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1005</field><field name=\"a_i1\">1</field><field name=\"b_si\">50</field></doc></add>");
+    assertU("<add allowDups=\"true\"><doc><field name=\"id_i\">1006</field><field name=\"a_i1\">0</field></doc></add>");
     assertU("<commit/>");
     assertQ(req("id_i:[1000 TO 1010]")
             ,"*[count(//doc)=7]"
@@ -759,13 +759,13 @@ public class ConvertedLegacyTest extends
             ,"//doc[1]/int[.='100'] "
             ,"//doc[2]/int[.='50']"
             );
-    assertQ(req("id_i:[1000 TO 1010]; a_i asc,b_si desc")
+    assertQ(req("id_i:[1000 TO 1010]; a_i1 asc,b_si desc")
             ,"*[count(//doc)=7] "
             ,"//doc[3]/int[.='100'] "
             ,"//doc[4]/int[.='50']  "
             ,"//doc[5]/int[.='1000']"
             );
-    assertQ(req("id_i:[1000 TO 1010]; a_i asc,b_si asc")
+    assertQ(req("id_i:[1000 TO 1010]; a_i1 asc,b_si asc")
             ,"*[count(//doc)=7] "
             ,"//doc[3]/int[.='50'] "
             ,"//doc[4]/int[.='100']  "

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/SolrTestCaseJ4.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/SolrTestCaseJ4.java Fri Feb  4 00:11:06 2011
@@ -649,4 +649,12 @@ public abstract class SolrTestCaseJ4 ext
     }
     return new File(base, "solr/").getAbsolutePath();
   }
+
+  public static Throwable getRootCause(Throwable t) {
+    Throwable result = t;
+    for (Throwable cause = t; null != cause; cause = cause.getCause()) {
+      result = cause;
+    }
+    return result;
+  }
 }

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/TestDistributedSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/TestDistributedSearch.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/TestDistributedSearch.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/TestDistributedSearch.java Fri Feb  4 00:11:06 2011
@@ -37,7 +37,7 @@ public class TestDistributedSearch exten
   String ndouble = "n_d";
   String tdouble = "n_td";
   String nlong = "n_l";
-  String tlong = "n_tl";
+  String tlong = "other_tl1";
   String ndate = "n_dt";
   String tdate = "n_tdt";
   
@@ -98,8 +98,8 @@ public class TestDistributedSearch exten
     query("q","*:*", "sort","{!func}add("+i1+",5)"+" desc");
     query("q","*:*", "sort",i1+" asc");
     query("q","*:*", "sort",i1+" desc", "fl","*,score");
-    query("q","*:*", "sort",tlong+" asc", "fl","score");  // test legacy behavior - "score"=="*,score"
-    query("q","*:*", "sort",tlong+" desc");
+    query("q","*:*", "sort","n_tl1 asc", "fl","score");  // test legacy behavior - "score"=="*,score"
+    query("q","*:*", "sort","n_tl1 desc");
     handle.put("maxScore", SKIPVAL);
     query("q","{!func}"+i1);// does not expect maxScore. So if it comes ,ignore it. JavaBinCodec.writeSolrDocumentList()
     //is agnostic of request params.

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/StandardRequestHandlerTest.java Fri Feb  4 00:11:06 2011
@@ -43,9 +43,9 @@ public class StandardRequestHandlerTest 
   
   public void testSorting() throws Exception {
     SolrCore core = h.getCore();
-    assertU(adoc("id", "10", "title", "test", "val_s", "aaa"));
-    assertU(adoc("id", "11", "title", "test", "val_s", "bbb"));
-    assertU(adoc("id", "12", "title", "test", "val_s", "ccc"));
+    assertU(adoc("id", "10", "title", "test", "val_s1", "aaa"));
+    assertU(adoc("id", "11", "title", "test", "val_s1", "bbb"));
+    assertU(adoc("id", "12", "title", "test", "val_s1", "ccc"));
     assertU(commit());
     
     Map<String,String> args = new HashMap<String, String>();
@@ -58,7 +58,7 @@ public class StandardRequestHandlerTest 
             ,"//*[@numFound='3']"
             );
     
-    args.put( CommonParams.SORT, "val_s asc" );
+    args.put( CommonParams.SORT, "val_s1 asc" );
     assertQ("with sort param [asc]", req
             ,"//*[@numFound='3']"
             ,"//result/doc[1]/int[@name='id'][.='10']"
@@ -66,7 +66,7 @@ public class StandardRequestHandlerTest 
             ,"//result/doc[3]/int[@name='id'][.='12']"
             );
 
-    args.put( CommonParams.SORT, "val_s desc" );
+    args.put( CommonParams.SORT, "val_s1 desc" );
     assertQ("with sort param [desc]", req
             ,"//*[@numFound='3']"
             ,"//result/doc[1]/int[@name='id'][.='12']"
@@ -84,7 +84,7 @@ public class StandardRequestHandlerTest 
     // Using legacy ';' param
     args.remove( CommonParams.SORT );
     args.put( QueryParsing.DEFTYPE, "lucenePlusSort" );
-    args.put( CommonParams.Q, "title:test; val_s desc" );
+    args.put( CommonParams.Q, "title:test; val_s1 desc" );
     assertQ("with sort param [desc]", req
             ,"//*[@numFound='3']"
             ,"//result/doc[1]/int[@name='id'][.='12']"
@@ -92,8 +92,8 @@ public class StandardRequestHandlerTest 
             ,"//result/doc[3]/int[@name='id'][.='10']"
             );
 
-    args.put( CommonParams.Q, "title:test; val_s asc" );
-    assertQ("with sort param [desc]", req
+    args.put( CommonParams.Q, "title:test; val_s1 asc" );
+    assertQ("with sort param [asc]", req
             ,"//*[@numFound='3']"
             ,"//result/doc[1]/int[@name='id'][.='10']"
             ,"//result/doc[2]/int[@name='id'][.='11']"

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java Fri Feb  4 00:11:06 2011
@@ -111,13 +111,13 @@ public class QueryElevationComponentTest
   @Test
   public void testSorting() throws IOException
   {
-    assertU(adoc("id", "a", "title", "ipod",           "str_s", "a" ));
-    assertU(adoc("id", "b", "title", "ipod ipod",      "str_s", "b" ));
-    assertU(adoc("id", "c", "title", "ipod ipod ipod", "str_s", "c" ));
-
-    assertU(adoc("id", "x", "title", "boosted",                 "str_s", "x" ));
-    assertU(adoc("id", "y", "title", "boosted boosted",         "str_s", "y" ));
-    assertU(adoc("id", "z", "title", "boosted boosted boosted", "str_s", "z" ));
+    assertU(adoc("id", "a", "title", "ipod",           "str_s1", "a" ));
+    assertU(adoc("id", "b", "title", "ipod ipod",      "str_s1", "b" ));
+    assertU(adoc("id", "c", "title", "ipod ipod ipod", "str_s1", "c" ));
+
+    assertU(adoc("id", "x", "title", "boosted",                 "str_s1", "x" ));
+    assertU(adoc("id", "y", "title", "boosted boosted",         "str_s1", "y" ));
+    assertU(adoc("id", "z", "title", "boosted boosted boosted", "str_s1", "z" ));
     assertU(commit());
     
     String query = "title:ipod";
@@ -179,7 +179,7 @@ public class QueryElevationComponentTest
     // Try normal sort by 'id'
     // default 'forceBoost' shoudl be false
     assertEquals( false, booster.forceElevation );
-    args.put( CommonParams.SORT, "str_s asc" );
+    args.put( CommonParams.SORT, "str_s1 asc" );
     assertQ( null, req
         ,"//*[@numFound='4']"
         ,"//result/doc[1]/str[@name='id'][.='a']"

Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/function/SortByFunctionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/function/SortByFunctionTest.java?rev=1067042&r1=1067041&r2=1067042&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/function/SortByFunctionTest.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/function/SortByFunctionTest.java Fri Feb  4 00:11:06 2011
@@ -35,10 +35,10 @@ public class SortByFunctionTest extends 
   }
 
   public void test() throws Exception {
-    assertU(adoc("id", "1", "x_td", "0", "y_td", "2", "w_td", "25", "z_td", "5", "f_t", "ipod"));
-    assertU(adoc("id", "2", "x_td", "2", "y_td", "2", "w_td", "15", "z_td", "5", "f_t", "ipod ipod ipod ipod ipod"));
-    assertU(adoc("id", "3", "x_td", "3", "y_td", "2", "w_td", "55", "z_td", "5", "f_t", "ipod ipod ipod ipod ipod ipod ipod ipod ipod"));
-    assertU(adoc("id", "4", "x_td", "4", "y_td", "2", "w_td", "45", "z_td", "5", "f_t", "ipod ipod ipod ipod ipod ipod ipod"));
+    assertU(adoc("id", "1", "x_td", "0", "y_td", "2", "w_td1", "25", "z_td", "5", "f_t", "ipod"));
+    assertU(adoc("id", "2", "x_td", "2", "y_td", "2", "w_td1", "15", "z_td", "5", "f_t", "ipod ipod ipod ipod ipod"));
+    assertU(adoc("id", "3", "x_td", "3", "y_td", "2", "w_td1", "55", "z_td", "5", "f_t", "ipod ipod ipod ipod ipod ipod ipod ipod ipod"));
+    assertU(adoc("id", "4", "x_td", "4", "y_td", "2", "w_td1", "45", "z_td", "5", "f_t", "ipod ipod ipod ipod ipod ipod ipod"));
     assertU(commit());
 
     assertQ(req("fl", "*,score", "q", "*:*"),
@@ -82,8 +82,8 @@ public class SortByFunctionTest extends 
             "//result/doc[3]/int[@name='id'][.='3']",
             "//result/doc[4]/int[@name='id'][.='4']"
     );
-    //the function is equal, w_td separates
-    assertQ(req("q", "*:*", "fl", "id", "sort", "sum(z_td, y_td) asc, w_td asc"),
+    //the function is equal, w_td1 separates
+    assertQ(req("q", "*:*", "fl", "id", "sort", "sum(z_td, y_td) asc, w_td1 asc"),
             "//*[@numFound='4']",
             "//result/doc[1]/int[@name='id'][.='2']",
             "//result/doc[2]/int[@name='id'][.='1']",
@@ -95,4 +95,4 @@ public class SortByFunctionTest extends 
 
 /*
 <lst name="responseHeader"><int name="status">0</int><int name="QTime">93</int></lst><result name="response" numFound="4" start="0" maxScore="1.0"><doc><float name="score">1.0</float><int name="id">4</int><int name="intDefault">42</int><arr name="multiDefault"><str>muLti-Default</str></arr><date name="timestamp">2009-12-12T12:59:46.412Z</date><arr name="x_td"><double>4.0</double></arr><arr name="y_td"><double>2.0</double></arr></doc><doc><float name="score">1.0</float><int name="id">3</int><int name="intDefault">42</int><arr name="multiDefault"><str>muLti-Default</str></arr><date name="timestamp">2009-12-12T12:59:46.409Z</date><arr name="x_td"><double>3.0</double></arr><arr name="y_td"><double>2.0</double></arr></doc><doc><float name="score">1.0</float><int name="id">2</int><int name="intDefault">42</int><arr name="multiDefault"><str>muLti-Default</str></arr><date name="timestamp">2009-12-12T12:59:46.406Z</date><arr name="x_td"><double>2.0</double></arr><arr name="y_td"><dou
 ble>2.0</double></arr></doc><doc><float name="score">1.0</float><int name="id">1</int><int name="intDefault">42</int><arr name="multiDefault"><str>muLti-Default</str></arr><date name="timestamp">2009-12-12T12:59:46.361Z</date><arr name="x_td"><double>0.0</double></arr><arr name="y_td"><double>2.0</double></arr></doc></result>
-*/
\ No newline at end of file
+*/



Mime
View raw message