lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r894183 - in /lucene/solr/trunk/src: java/org/apache/solr/schema/ java/org/apache/solr/search/ test/org/apache/solr/schema/ test/org/apache/solr/search/function/distance/
Date Mon, 28 Dec 2009 14:41:18 GMT
Author: gsingers
Date: Mon Dec 28 14:41:18 2009
New Revision: 894183

URL: http://svn.apache.org/viewvc?rev=894183&view=rev
Log:
SOLR-1131: change toMultiVS to vector

Added:
    lucene/solr/trunk/src/java/org/apache/solr/search/VectorValueSource.java   (contents,
props changed)
      - copied, changed from r894059, lucene/solr/trunk/src/java/org/apache/solr/search/ToMultiValueSource.java
Removed:
    lucene/solr/trunk/src/java/org/apache/solr/search/ToMultiValueSource.java
Modified:
    lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java
    lucene/solr/trunk/src/java/org/apache/solr/search/ValueSourceParser.java
    lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java
    lucene/solr/trunk/src/test/org/apache/solr/search/function/distance/DistanceFunctionTest.java

Modified: lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java?rev=894183&r1=894182&r2=894183&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/schema/PointType.java Mon Dec 28 14:41:18 2009
@@ -19,21 +19,17 @@
 
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.Fieldable;
-import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.search.BooleanClause;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Searcher;
 import org.apache.lucene.search.SortField;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.MapSolrParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.request.TextResponseWriter;
 import org.apache.solr.request.XMLWriter;
-import org.apache.solr.search.MultiValueSource;
 import org.apache.solr.search.QParser;
-import org.apache.solr.search.ToMultiValueSource;
-import org.apache.solr.search.function.DocValues;
+import org.apache.solr.search.VectorValueSource;
 import org.apache.solr.search.function.ValueSource;
 import org.apache.solr.search.function.distance.DistanceUtils;
 
@@ -176,7 +172,7 @@
 }
 
 
-class PointTypeValueSource extends ToMultiValueSource {
+class PointTypeValueSource extends VectorValueSource {
   private final SchemaField sf;
   
   public PointTypeValueSource(SchemaField sf, List<ValueSource> sources) {

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/ValueSourceParser.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/ValueSourceParser.java?rev=894183&r1=894182&r2=894183&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/ValueSourceParser.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/ValueSourceParser.java Mon Dec 28 14:41:18
2009
@@ -203,9 +203,9 @@
         };
       }
     });
-    addParser("toMultiVS", new ValueSourceParser(){
+    addParser("vector", new ValueSourceParser(){
       public ValueSource parse(FunctionQParser fp) throws ParseException{
-        return new ToMultiValueSource(fp.parseValueSourceList());
+        return new VectorValueSource(fp.parseValueSourceList());
       }
     });
     addParser("query", new ValueSourceParser() {
@@ -240,13 +240,13 @@
           List<ValueSource> s1 = new ArrayList<ValueSource>();
           s1.add(one);
           s1.add(two);
-          pv1 = new ToMultiValueSource(s1);
+          pv1 = new VectorValueSource(s1);
           ValueSource x2 = fp.parseValueSource();
           ValueSource y2 = fp.parseValueSource();
           List<ValueSource> s2 = new ArrayList<ValueSource>();
           s2.add(x2);
           s2.add(y2);
-          pv2 = new ToMultiValueSource(s2);
+          pv2 = new VectorValueSource(s2);
         } else {
           //check to see if we have multiValue source
           if (one instanceof MultiValueSource && two instanceof MultiValueSource){
@@ -482,8 +482,8 @@
         //if one is a MultiValueSource, than the other one needs to be too.
         throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Illegal number of sources.
 There must be an even number of sources");
       } else {
-        mvr.mv1 = new ToMultiValueSource(Collections.singletonList(sources.get(0)));
-        mvr.mv2 = new ToMultiValueSource(Collections.singletonList(sources.get(1)));
+        mvr.mv1 = new VectorValueSource(Collections.singletonList(sources.get(0)));
+        mvr.mv2 = new VectorValueSource(Collections.singletonList(sources.get(1)));
       }
     } else {
       int dim = sources.size() / 2;
@@ -491,8 +491,8 @@
       List<ValueSource> sources2 = new ArrayList<ValueSource>(dim);
       //Get dim value sources for the first vector
       splitSources(dim, sources, sources1, sources2);
-      mvr.mv1 = new ToMultiValueSource(sources1);
-      mvr.mv2 = new ToMultiValueSource(sources2);
+      mvr.mv1 = new VectorValueSource(sources1);
+      mvr.mv2 = new VectorValueSource(sources2);
     }
 
     return mvr;

Copied: lucene/solr/trunk/src/java/org/apache/solr/search/VectorValueSource.java (from r894059,
lucene/solr/trunk/src/java/org/apache/solr/search/ToMultiValueSource.java)
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/VectorValueSource.java?p2=lucene/solr/trunk/src/java/org/apache/solr/search/VectorValueSource.java&p1=lucene/solr/trunk/src/java/org/apache/solr/search/ToMultiValueSource.java&r1=894059&r2=894183&rev=894183&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/ToMultiValueSource.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/VectorValueSource.java Mon Dec 28 14:41:18
2009
@@ -31,11 +31,11 @@
  * i.e. {@link org.apache.solr.search.function.DocValues#doubleVal(int, double[])}
  */
 //Not crazy about the name, but...
-public class ToMultiValueSource extends MultiValueSource {
+public class VectorValueSource extends MultiValueSource {
   protected List<ValueSource> sources;
 
 
-  public ToMultiValueSource(List<ValueSource> sources) {
+  public VectorValueSource(List<ValueSource> sources) {
     this.sources = sources;
   }
 
@@ -48,7 +48,7 @@
   }
 
   public String name() {
-    return "toMultiVS";
+    return "vector";
   }
 
   @Override
@@ -202,9 +202,9 @@
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;
-    if (!(o instanceof ToMultiValueSource)) return false;
+    if (!(o instanceof VectorValueSource)) return false;
 
-    ToMultiValueSource that = (ToMultiValueSource) o;
+    VectorValueSource that = (VectorValueSource) o;
 
     if (!sources.equals(that.sources)) return false;
 

Propchange: lucene/solr/trunk/src/java/org/apache/solr/search/VectorValueSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java?rev=894183&r1=894182&r2=894183&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/schema/PolyFieldTest.java Mon Dec 28 14:41:18
2009
@@ -143,10 +143,10 @@
             "//*[@numFound='1']",
             "//str[@name='homed'][.='1000,10000']");
     assertQ(req("fl", "*,score", "q",
-            "{!func}sqedist(home, toMultiVS(0, 0))"),
+            "{!func}sqedist(home, vector(0, 0))"),
             "\"//*[@numFound='50']\"");
     assertQ(req("fl", "*,score", "q",
-            "{!func}dist(2, home, toMultiVS(0, 0))"),
+            "{!func}dist(2, home, vector(0, 0))"),
             "\"//*[@numFound='50']\"");
 
     assertQ(req("fl", "*,score", "q",

Modified: lucene/solr/trunk/src/test/org/apache/solr/search/function/distance/DistanceFunctionTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/search/function/distance/DistanceFunctionTest.java?rev=894183&r1=894182&r2=894183&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/search/function/distance/DistanceFunctionTest.java
(original)
+++ lucene/solr/trunk/src/test/org/apache/solr/search/function/distance/DistanceFunctionTest.java
Mon Dec 28 14:41:18 2009
@@ -117,10 +117,10 @@
 
 
     //Do point tests:
-    assertQ(req("fl", "*,score", "q", "{!func}dist(1, toMultiVS(x_td, y_td), toMultiVS(0,
0))", "fq", "id:5"),
+    assertQ(req("fl", "*,score", "q", "{!func}dist(1, vector(x_td, y_td), vector(0, 0))",
"fq", "id:5"),
             "//float[@name='score']='" + (float) (2.3 + 5.5) + "'");
 
-    assertQ(req("fl", "*,score", "q", "{!func}dist(1, point, toMultiVS(0, 0))", "fq", "id:6"),
+    assertQ(req("fl", "*,score", "q", "{!func}dist(1, point, vector(0, 0))", "fq", "id:6"),
             "//float[@name='score']='" + 1.0f + "'");
 
   }



Mime
View raw message