You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2011/02/21 15:13:40 UTC

svn commit: r1072973 [11/11] - in /lucene/dev/branches/docvalues: ./ dev-tools/eclipse/ dev-tools/idea/.idea/ dev-tools/idea/lucene/contrib/ant/ dev-tools/idea/lucene/contrib/demo/ dev-tools/idea/lucene/contrib/highlighter/ dev-tools/idea/lucene/contri...

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableLongField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableLongField.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableLongField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/SortableLongField.java Mon Feb 21 14:13:28 2011
@@ -53,6 +53,7 @@ public class SortableLongField extends F
 
   @Override
   public ValueSource getValueSource(SchemaField field, QParser qparser) {
+    field.checkFieldCacheSource(qparser);
     return new SortableLongFieldSource(field.name);
   }
 

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/StrField.java Mon Feb 21 14:13:28 2011
@@ -48,6 +48,7 @@ public class StrField extends FieldType 
 
   @Override
   public ValueSource getValueSource(SchemaField field, QParser parser) {
+    field.checkFieldCacheSource(parser);
     return new StrFieldSource(field.getName());
   }
 

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieDateField.java Mon Feb 21 14:13:28 2011
@@ -83,12 +83,8 @@ public class TrieDateField extends DateF
   }
 
   @Override
-  public ValueSource getValueSource(SchemaField field) {
-    return new TrieDateFieldSource( new LongValuesCreator( field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER, CachedArrayCreator.CACHE_VALUES_AND_BITS ));
-  }
-
-  @Override
   public ValueSource getValueSource(SchemaField field, QParser parser) {
+    field.checkFieldCacheSource(parser);
     return new TrieDateFieldSource( new LongValuesCreator( field.getName(), FieldCache.NUMERIC_UTILS_LONG_PARSER, CachedArrayCreator.CACHE_VALUES_AND_BITS ));
   }
 

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/schema/TrieField.java Mon Feb 21 14:13:28 2011
@@ -179,6 +179,7 @@ public class TrieField extends FieldType
 
   @Override
   public ValueSource getValueSource(SchemaField field, QParser qparser) {
+    field.checkFieldCacheSource(qparser);
     int flags = CachedArrayCreator.CACHE_VALUES_AND_BITS;
     switch (type) {
       case INTEGER:

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ExtendedDismaxQParserPlugin.java Mon Feb 21 14:13:28 2011
@@ -48,6 +48,7 @@ import java.io.IOException;
 
 /**
  * An advanced multi-field query parser.
+ * @lucene.experimental
  */
 public class ExtendedDismaxQParserPlugin extends QParserPlugin {
   public static final String NAME = "edismax";

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ValueSourceParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ValueSourceParser.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ValueSourceParser.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/ValueSourceParser.java Mon Feb 21 14:13:28 2011
@@ -117,14 +117,6 @@ public abstract class ValueSourceParser 
         return new LinearFloatFunction(source, slope, intercept);
       }
     });
-    addParser("max", new ValueSourceParser() {
-      @Override
-      public ValueSource parse(FunctionQParser fp) throws ParseException {
-        ValueSource source = fp.parseValueSource();
-        float val = fp.parseFloat();
-        return new MaxFloatFunction(source, val);
-      }
-    });
     addParser("recip", new ValueSourceParser() {
       @Override
       public ValueSource parse(FunctionQParser fp) throws ParseException {
@@ -476,6 +468,18 @@ public abstract class ValueSourceParser 
         return Math.atan2(a.doubleVal(doc), b.doubleVal(doc));
       }
     });
+    addParser(new Double2Parser("max") {
+      @Override
+      public double func(int doc, DocValues a, DocValues b) {
+        return Math.max(a.doubleVal(doc), b.doubleVal(doc));
+      }
+    });
+    addParser(new Double2Parser("min") {
+      @Override
+      public double func(int doc, DocValues a, DocValues b) {
+        return Math.min(a.doubleVal(doc), b.doubleVal(doc));
+      }
+    });
 
     addParser("sqedist", new ValueSourceParser() {
       @Override

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/ValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/ValueSource.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/ValueSource.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/search/function/ValueSource.java Mon Feb 21 14:13:28 2011
@@ -90,7 +90,6 @@ public abstract class ValueSource implem
 
   /**
    * EXPERIMENTAL: This method is subject to change.
-   * <br>WARNING: Sorted function queries are not currently weighted.
    * <p>
    * Get the SortField for this ValueSource.  Uses the {@link #getValues(java.util.Map, IndexReader.AtomicReaderContext)}
    * to populate the SortField.

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/spelling/SpellCheckCollator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/spelling/SpellCheckCollator.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/spelling/SpellCheckCollator.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/spelling/SpellCheckCollator.java Mon Feb 21 14:13:28 2011
@@ -29,7 +29,6 @@ import org.apache.solr.handler.component
 import org.apache.solr.handler.component.SearchComponent;
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.response.SolrQueryResponse;
-import org.mortbay.log.Log;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -91,7 +90,7 @@ public class SpellCheckCollator {
           queryComponent.process(checkResponse);
           hits = (Integer) checkResponse.rsp.getToLog().get("hits");
         } catch (Exception e) {
-          Log.warn("Exception trying to re-query to check if a spell check possibility would return any hits.", e);
+          LOG.warn("Exception trying to re-query to check if a spell check possibility would return any hits.", e);
         } finally {
           checkResponse.req.close();  
         }

Modified: lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java (original)
+++ lucene/dev/branches/docvalues/solr/src/java/org/apache/solr/update/DirectUpdateHandler2.java Mon Feb 21 14:13:28 2011
@@ -91,7 +91,9 @@ public class DirectUpdateHandler2 extend
   public DirectUpdateHandler2(SolrCore core) throws IOException {
     super(core);
 
-    ReadWriteLock rwl = new ReentrantReadWriteLock();
+    // Pass fairness=true so commit request is not starved
+    // when add/updates are running hot (SOLR-2342):
+    ReadWriteLock rwl = new ReentrantReadWriteLock(true);
     iwAccess = rwl.readLock();
     iwCommit = rwl.writeLock();
 

Modified: lucene/dev/branches/docvalues/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java (original)
+++ lucene/dev/branches/docvalues/solr/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java Mon Feb 21 14:13:28 2011
@@ -178,6 +178,8 @@ public class StreamingUpdateSolrServer e
 
         // remove it from the list of running things unless we are the last runner and the queue is full...
         // in which case, the next queue.put() would block and there would be no runners to handle it.
+        // This case has been further handled by using offer instead of put, and using a retry loop
+        // to avoid blocking forever (see request()).
         synchronized (runners) {
           if (runners.size() == 1 && queue.remainingCapacity() == 0) {
            // keep this runner alive
@@ -223,18 +225,40 @@ public class StreamingUpdateSolrServer e
         tmpLock.await();
       }
 
-      queue.put( req );
+      boolean success = queue.offer(req);
 
-      synchronized( runners ) {
-        if( runners.isEmpty()
-                || (queue.remainingCapacity() < queue.size()
-                && runners.size() < threadCount) )
-        {
-          Runner r = new Runner();
-          scheduler.execute( r );
-          runners.add( r );
+      for(;;) {
+        synchronized( runners ) {
+          if( runners.isEmpty()
+                  || (queue.remainingCapacity() < queue.size()    // queue is half full and we can add more runners
+                  && runners.size() < threadCount) )
+          {
+            // We need more runners, so start a new one.
+            Runner r = new Runner();
+            runners.add( r );
+            scheduler.execute( r );
+          } else {
+            // break out of the retry loop if we added the element to the queue successfully, *and*
+            // while we are still holding the runners lock to prevent race conditions.
+            // race conditions.
+            if (success) break;
+          }
+        }
+
+        // Retry to add to the queue w/o the runners lock held (else we risk temporary deadlock)
+        // This retry could also fail because
+        // 1) existing runners were not able to take off any new elements in the queue
+        // 2) the queue was filled back up since our last try
+        // If we succeed, the queue may have been completely emptied, and all runners stopped.
+        // In all cases, we should loop back to the top to see if we need to start more runners.
+        //
+        if (!success) {
+          success = queue.offer(req, 100, TimeUnit.MILLISECONDS);
         }
+
       }
+
+
     }
     catch (InterruptedException e) {
       log.error( "interrupted", e );

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/schema.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/schema.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/schema.xml Mon Feb 21 14:13:28 2011
@@ -385,7 +385,7 @@
   <fieldType name="x" class="solr.PointType" dimension="1" subFieldType="double"/>
   <fieldType name="tenD" class="solr.PointType" dimension="10" subFieldType="double"/>
     <!-- Use the sub field suffix -->
-  <fieldType name="xyd" class="solr.PointType" dimension="2" subFieldSuffix="*_d"/>
+  <fieldType name="xyd" class="solr.PointType" dimension="2" subFieldSuffix="_d1"/>
     <fieldtype name="geohash" class="solr.GeoHashField"/>
 
 
@@ -533,6 +533,7 @@
    <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="*_tds" 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"/>
 

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-elevate.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-elevate.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-elevate.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-elevate.xml Mon Feb 21 14:13:28 2011
@@ -29,7 +29,7 @@
   <!-- Used to specify an alternate directory to hold all index data.
        It defaults to "index" if not present, and should probably
        not be changed if replication is in use. -->
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <!--  The DirectoryFactory to use for indexes.
         solr.StandardDirectoryFactory, the default, is filesystem based.

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-enableplugin.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-enableplugin.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-enableplugin.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-enableplugin.xml Mon Feb 21 14:13:28 2011
@@ -24,7 +24,7 @@
 
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <!--  The DirectoryFactory to use for indexes.
         solr.StandardDirectoryFactory, the default, is filesystem based.

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master.xml Mon Feb 21 14:13:28 2011
@@ -25,7 +25,7 @@
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>  
 
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <indexDefaults>
     <useCompoundFile>false</useCompoundFile>

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master1.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master1.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master1.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master1.xml Mon Feb 21 14:13:28 2011
@@ -24,7 +24,7 @@
 
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <indexDefaults>
     <useCompoundFile>false</useCompoundFile>

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master2.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master2.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master2.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-master2.xml Mon Feb 21 14:13:28 2011
@@ -24,7 +24,7 @@
 
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <indexDefaults>
     <useCompoundFile>false</useCompoundFile>

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-repeater.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-repeater.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-repeater.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-repeater.xml Mon Feb 21 14:13:28 2011
@@ -25,7 +25,7 @@
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
 
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <indexDefaults>
     <useCompoundFile>false</useCompoundFile>

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-slave.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-slave.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-slave.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-slave.xml Mon Feb 21 14:13:28 2011
@@ -25,7 +25,7 @@
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
 
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <indexDefaults>
     <useCompoundFile>false</useCompoundFile>

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-slave1.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-slave1.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-slave1.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-slave1.xml Mon Feb 21 14:13:28 2011
@@ -24,7 +24,7 @@
 
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <indexDefaults>
     <useCompoundFile>false</useCompoundFile>

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-solcoreproperties.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-solcoreproperties.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-solcoreproperties.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-solcoreproperties.xml Mon Feb 21 14:13:28 2011
@@ -24,7 +24,7 @@
 
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <!--  The DirectoryFactory to use for indexes.
         solr.StandardDirectoryFactory, the default, is filesystem based.

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-spellcheckcomponent.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-spellcheckcomponent.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-spellcheckcomponent.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig-spellcheckcomponent.xml Mon Feb 21 14:13:28 2011
@@ -32,7 +32,7 @@ Config for testing spellcheck component
   <!-- Used to specify an alternate directory to hold all index data.
        It defaults to "index" if not present, and should probably
        not be changed if replication is in use. -->
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <!--  The DirectoryFactory to use for indexes.
         solr.StandardDirectoryFactory, the default, is filesystem based.

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig.xml Mon Feb 21 14:13:28 2011
@@ -43,7 +43,7 @@
   <!-- Used to specify an alternate directory to hold all index data.
        It defaults to "index" if not present, and should probably
        not be changed if replication is in use. -->
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <!--  The DirectoryFactory to use for indexes.
         solr.StandardDirectoryFactory, the default, is filesystem based.

Modified: lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig_perf.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig_perf.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig_perf.xml (original)
+++ lucene/dev/branches/docvalues/solr/src/test-files/solr/conf/solrconfig_perf.xml Mon Feb 21 14:13:28 2011
@@ -21,7 +21,7 @@
   <!-- Used to specify an alternate directory to hold all index data
        other than the default ./data under the Solr home.
        If replication is in use, this should match the replication configuration. -->
-  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+  <dataDir>${solr.data.dir:}</dataDir>
 
   <!--  The DirectoryFactory to use for indexes.
         solr.StandardDirectoryFactory, the default, is filesystem based.

Modified: lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/QueryParsingTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/QueryParsingTest.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/QueryParsingTest.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/QueryParsingTest.java Mon Feb 21 14:13:28 2011
@@ -102,10 +102,10 @@ public class QueryParsingTest extends So
     assertEquals(flds[0].getField(), "pow(float(weight),const(2.0))");
     
     //test functions (more deep)
-    sort = QueryParsing.parseSort("sum(product(r_f,sum(d_f,t_f,1)),a_f) asc", req);
+    sort = QueryParsing.parseSort("sum(product(r_f1,sum(d_f1,t_f1,1)),a_f1) asc", req);
     flds = sort.getSort();
     assertEquals(flds[0].getType(), SortField.CUSTOM);
-    assertEquals(flds[0].getField(), "sum(product(float(r_f),sum(float(d_f),float(t_f),const(1.0))),float(a_f))");
+    assertEquals(flds[0].getField(), "sum(product(float(r_f1),sum(float(d_f1),float(t_f1),const(1.0))),float(a_f1))");
 
     sort = QueryParsing.parseSort("pow(weight,                 2)         desc", req);
     flds = sort.getSort();
@@ -135,11 +135,11 @@ public class QueryParsingTest extends So
     assertEquals(flds[0].getField(), "weight");
 
     //Test literals in functions
-    sort = QueryParsing.parseSort("strdist(foo_s, \"junk\", jw) desc", req);
+    sort = QueryParsing.parseSort("strdist(foo_s1, \"junk\", jw) desc", req);
     flds = sort.getSort();
     assertEquals(flds[0].getType(), SortField.CUSTOM);
     //the value sources get wrapped, so the out field is different than the input
-    assertEquals(flds[0].getField(), "strdist(str(foo_s),literal(junk), dist=org.apache.lucene.search.spell.JaroWinklerDistance)");
+    assertEquals(flds[0].getField(), "strdist(str(foo_s1),literal(junk), dist=org.apache.lucene.search.spell.JaroWinklerDistance)");
 
     sort = QueryParsing.parseSort("", req);
     assertNull(sort);

Modified: lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/TestIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/TestIndexSearcher.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/TestIndexSearcher.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/TestIndexSearcher.java Mon Feb 21 14:13:28 2011
@@ -59,18 +59,18 @@ public class TestIndexSearcher extends S
 
   public void testReopen() throws Exception {
 
-    assertU(adoc("id","1", "v_t","Hello Dude", "v_s","string1"));
-    assertU(adoc("id","2", "v_t","Hello Yonik", "v_s","string2"));
+    assertU(adoc("id","1", "v_t","Hello Dude", "v_s1","string1"));
+    assertU(adoc("id","2", "v_t","Hello Yonik", "v_s1","string2"));
     assertU(commit());
 
     SolrQueryRequest sr1 = req("q","foo");
     ReaderContext rCtx1 = sr1.getSearcher().getTopReaderContext();
 
-    String sval1 = getStringVal(sr1, "v_s",0);
+    String sval1 = getStringVal(sr1, "v_s1",0);
     assertEquals("string1", sval1);
 
-    assertU(adoc("id","3", "v_s","{!literal}"));
-    assertU(adoc("id","4", "v_s","other stuff"));
+    assertU(adoc("id","3", "v_s1","{!literal}"));
+    assertU(adoc("id","4", "v_s1","other stuff"));
     assertU(commit());
 
     SolrQueryRequest sr2 = req("q","foo");
@@ -81,7 +81,7 @@ public class TestIndexSearcher extends S
     assertEquals(ReaderUtil.leaves(rCtx1)[0].reader, ReaderUtil.leaves(rCtx2)[0].reader);
 
     assertU(adoc("id","5", "v_f","3.14159"));
-    assertU(adoc("id","6", "v_f","8983", "v_s","string6"));
+    assertU(adoc("id","6", "v_f","8983", "v_s1","string6"));
     assertU(commit());
 
     SolrQueryRequest sr3 = req("q","foo");
@@ -129,4 +129,4 @@ public class TestIndexSearcher extends S
     sr5.close();
     sr6.close();
   }
-}
\ No newline at end of file
+}

Modified: lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/TestQueryTypes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/TestQueryTypes.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/TestQueryTypes.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/TestQueryTypes.java Mon Feb 21 14:13:28 2011
@@ -87,7 +87,6 @@ public class TestQueryTypes extends Abst
               ,"//*[@name='id'][.='999.0']"
               ,"//*[@name='" + f + "'][.='" + v + "']"
               );
-      // System.out.println("#########################################" + f + "=" + v);
 
       // field qparser
       assertQ(req( "q", "{!field f="+f+"}"+v)
@@ -98,20 +97,34 @@ public class TestQueryTypes extends Abst
       assertQ(req( "q", f + ":[\"" + v + "\" TO \"" + v + "\"]" )
               ,"//result[@numFound='1']"
               );
+    }
 
+    // frange and function query only work on single valued field types
+    Object[] fc_vals = new Object[] {
+      "id",999.0
+      ,"v_s","wow dude"
+      ,"v_ti",-1
+      ,"v_tl",-1234567891234567890L
+      ,"v_tf",-2.0f
+      ,"v_td",-2.0
+      ,"v_tdt","2000-05-10T01:01:01Z"
+    };
+    
+    for (int i=0; i<fc_vals.length; i+=2) {
+      String f = fc_vals[i].toString();
+      String v = fc_vals[i+1].toString();
+      
       // frange qparser
       assertQ(req( "q", "{!frange v="+f+" l='"+v+"' u='"+v+"'}" )
               ,"//result[@numFound='1']"
               );
-
+      
       // function query... just make sure it doesn't throw an exception
-       assertQ(req( "q", "+id:999 _val_:\"" + f + "\"")
-            ,"//result[@numFound='1']"
-        );
-
+      assertQ(req( "q", "+id:999 _val_:\"" + f + "\"")
+              ,"//result[@numFound='1']"
+              );
     }
 
-
     // Some basic tests to ensure that parsing local params is working
     assertQ("test prefix query",
             req("q","{!prefix f=v_t}hel")
@@ -318,4 +331,4 @@ public class TestQueryTypes extends Abst
             );
 
   }
-}
\ No newline at end of file
+}

Modified: lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/SortByFunctionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/SortByFunctionTest.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/SortByFunctionTest.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/SortByFunctionTest.java Mon Feb 21 14:13:28 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_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(adoc("id", "1", "x_td1", "0", "y_td1", "2", "w_td1", "25", "z_td1", "5", "f_t", "ipod"));
+    assertU(adoc("id", "2", "x_td1", "2", "y_td1", "2", "w_td1", "15", "z_td1", "5", "f_t", "ipod ipod ipod ipod ipod"));
+    assertU(adoc("id", "3", "x_td1", "3", "y_td1", "2", "w_td1", "55", "z_td1", "5", "f_t", "ipod ipod ipod ipod ipod ipod ipod ipod ipod"));
+    assertU(adoc("id", "4", "x_td1", "4", "y_td1", "2", "w_td1", "45", "z_td1", "5", "f_t", "ipod ipod ipod ipod ipod ipod ipod"));
     assertU(commit());
 
     assertQ(req("fl", "*,score", "q", "*:*"),
@@ -66,7 +66,7 @@ public class SortByFunctionTest extends 
     );
 
 
-    assertQ(req("fl", "*,score", "q", "*:*", "sort", "sum(x_td, y_td) desc"),
+    assertQ(req("fl", "*,score", "q", "*:*", "sort", "sum(x_td1, y_td1) desc"),
             "//*[@numFound='4']",
             "//float[@name='score']='1.0'",
             "//result/doc[1]/int[@name='id'][.='4']",
@@ -74,7 +74,7 @@ public class SortByFunctionTest extends 
             "//result/doc[3]/int[@name='id'][.='2']",
             "//result/doc[4]/int[@name='id'][.='1']"
     );
-    assertQ(req("fl", "*,score", "q", "*:*", "sort", "sum(x_td, y_td) asc"),
+    assertQ(req("fl", "*,score", "q", "*:*", "sort", "sum(x_td1, y_td1) asc"),
             "//*[@numFound='4']",
             "//float[@name='score']='1.0'",
             "//result/doc[1]/int[@name='id'][.='1']",
@@ -83,7 +83,7 @@ public class SortByFunctionTest extends 
             "//result/doc[4]/int[@name='id'][.='4']"
     );
     //the function is equal, w_td1 separates
-    assertQ(req("q", "*:*", "fl", "id", "sort", "sum(z_td, y_td) asc, w_td1 asc"),
+    assertQ(req("q", "*:*", "fl", "id", "sort", "sum(z_td1, y_td1) asc, w_td1 asc"),
             "//*[@numFound='4']",
             "//result/doc[1]/int[@name='id'][.='2']",
             "//result/doc[2]/int[@name='id'][.='1']",
@@ -124,7 +124,3 @@ 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>
-*/

Modified: lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/TestFunctionQuery.java Mon Feb 21 14:13:28 2011
@@ -299,7 +299,7 @@ public class TestFunctionQuery extends S
     state.setBoost(1.0f);
     state.setLength(4);
     assertQ(req("fl","*,score","q", "{!func}norm(a_t)", "fq","id:2"),
-        "//float[@name='score']='" + similarity.computeNorm("a_t",state)  + "'");  // sqrt(4)==2 and is exactly representable when quantized to a byte
+        "//float[@name='score']='" + similarity.computeNorm(state)  + "'");  // sqrt(4)==2 and is exactly representable when quantized to a byte
 
     // test that ord and rord are working on a global index basis, not just
     // at the segment level (since Lucene 2.9 has switched to per-segment searching)
@@ -498,6 +498,8 @@ public class TestFunctionQuery extends S
     dofunc("deg(.5)", Math.toDegrees(.5));
     dofunc("sqrt(9)", Math.sqrt(9));
     dofunc("cbrt(8)", Math.cbrt(8));
+    dofunc("max(0,1)", Math.max(0,1));
+    dofunc("min(0,1)", Math.min(0,1));
     dofunc("log(100)", Math.log10(100));
     dofunc("ln(3)", Math.log(3));
     dofunc("exp(1)", Math.exp(1));

Modified: lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/distance/DistanceFunctionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/distance/DistanceFunctionTest.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/distance/DistanceFunctionTest.java (original)
+++ lucene/dev/branches/docvalues/solr/src/test/org/apache/solr/search/function/distance/DistanceFunctionTest.java Mon Feb 21 14:13:28 2011
@@ -36,12 +36,12 @@ public class DistanceFunctionTest extend
   @Test
   public void testHaversine() throws Exception {
     clearIndex();
-    assertU(adoc("id", "1", "x_td", "0", "y_td", "0", "gh_s", GeoHashUtils.encode(32.7693246, -79.9289094)));
-    assertU(adoc("id", "2", "x_td", "0", "y_td", String.valueOf(Math.PI / 2), "gh_s", GeoHashUtils.encode(32.7693246, -78.9289094)));
-    assertU(adoc("id", "3", "x_td", String.valueOf(Math.PI / 2), "y_td", String.valueOf(Math.PI / 2), "gh_s", GeoHashUtils.encode(32.7693246, -80.9289094)));
-    assertU(adoc("id", "4", "x_td", String.valueOf(Math.PI / 4), "y_td", String.valueOf(Math.PI / 4), "gh_s", GeoHashUtils.encode(32.7693246, -81.9289094)));
+    assertU(adoc("id", "1", "x_td", "0", "y_td", "0", "gh_s1", GeoHashUtils.encode(32.7693246, -79.9289094)));
+    assertU(adoc("id", "2", "x_td", "0", "y_td", String.valueOf(Math.PI / 2), "gh_s1", GeoHashUtils.encode(32.7693246, -78.9289094)));
+    assertU(adoc("id", "3", "x_td", String.valueOf(Math.PI / 2), "y_td", String.valueOf(Math.PI / 2), "gh_s1", GeoHashUtils.encode(32.7693246, -80.9289094)));
+    assertU(adoc("id", "4", "x_td", String.valueOf(Math.PI / 4), "y_td", String.valueOf(Math.PI / 4), "gh_s1", GeoHashUtils.encode(32.7693246, -81.9289094)));
     assertU(adoc("id", "5", "x_td", "45.0", "y_td", "45.0",
-            "gh_s", GeoHashUtils.encode(32.7693246, -81.9289094)));
+            "gh_s1", GeoHashUtils.encode(32.7693246, -81.9289094)));
     assertU(adoc("id", "6", "point_hash", "32.5, -79.0", "point", "32.5, -79.0"));
     assertU(adoc("id", "7", "point_hash", "32.6, -78.0", "point", "32.6, -78.0"));
     assertU(commit());
@@ -56,7 +56,7 @@ public class DistanceFunctionTest extend
     
     //Geo Hash Haversine
     //Can verify here: http://www.movable-type.co.uk/scripts/latlong.html, but they use a slightly different radius for the earth, so just be close
-    assertQ(req("fl", "*,score", "q", "{!func}ghhsin(" + DistanceUtils.EARTH_MEAN_RADIUS_KM + ", gh_s, \"" + GeoHashUtils.encode(32, -79) +
+    assertQ(req("fl", "*,score", "q", "{!func}ghhsin(" + DistanceUtils.EARTH_MEAN_RADIUS_KM + ", gh_s1, \"" + GeoHashUtils.encode(32, -79) +
             "\",)", "fq", "id:1"), "//float[@name='score']='122.171875'");
 
     assertQ(req("fl", "id,point_hash,score", "q", "{!func}recip(ghhsin(" + DistanceUtils.EARTH_MEAN_RADIUS_KM + ", point_hash, \"" + GeoHashUtils.encode(32, -79) + "\"), 1, 1, 0)"),
@@ -66,7 +66,7 @@ public class DistanceFunctionTest extend
             );
 
 
-    assertQ(req("fl", "*,score", "q", "{!func}ghhsin(" + DistanceUtils.EARTH_MEAN_RADIUS_KM + ", gh_s, geohash(32, -79))", "fq", "id:1"), "//float[@name='score']='122.171875'");
+    assertQ(req("fl", "*,score", "q", "{!func}ghhsin(" + DistanceUtils.EARTH_MEAN_RADIUS_KM + ", gh_s1, geohash(32, -79))", "fq", "id:1"), "//float[@name='score']='122.171875'");
 
   }