You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2012/07/11 08:29:51 UTC

svn commit: r1360029 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/spatial/ lucene/spatial/src/java/org/apache/lucene/spatial/ lucene/spatial/src/test/org/apache/lucene/spatial/ lucene/spatial/src/test/org/apache/lucene/spatial/prefix/

Author: dsmiley
Date: Wed Jul 11 06:29:50 2012
New Revision: 1360029

URL: http://svn.apache.org/viewvc?rev=1360029&view=rev
Log:
LUCENE-4188 inlined/removed SpatialStrategy.createStoredField()

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/spatial/   (props changed)
    lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java
    lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java
    lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java
    lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java
    lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java

Modified: lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java?rev=1360029&r1=1360028&r2=1360029&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java (original)
+++ lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java Wed Jul 11 06:29:50 2012
@@ -19,7 +19,6 @@ package org.apache.lucene.spatial;
 
 import com.spatial4j.core.context.SpatialContext;
 import com.spatial4j.core.shape.Shape;
-import org.apache.lucene.document.StoredField;
 import org.apache.lucene.index.IndexableField;
 import org.apache.lucene.queries.function.FunctionQuery;
 import org.apache.lucene.queries.function.ValueSource;
@@ -97,16 +96,6 @@ public abstract class SpatialStrategy {
   }
 
   /**
-   * A convenience method for storing the shape in Lucene for retrieval in search results.
-   * After calling this, add it to the document: {@link org.apache.lucene.document.Document#add(org.apache.lucene.index.IndexableField)}.
-   * All this does is:
-   * <pre>return new StoredField(getFieldName(),ctx.toString(shape));</pre>
-   */
-  public StoredField createStoredField(Shape shape) {
-    return new StoredField(getFieldName(), ctx.toString(shape));
-  }
-
-  /**
    * The value source yields a number that is proportional to the distance between the query shape and indexed data.
    */
   public abstract ValueSource makeValueSource(SpatialArgs args);

Modified: lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java?rev=1360029&r1=1360028&r2=1360029&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java (original)
+++ lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java Wed Jul 11 06:29:50 2012
@@ -25,6 +25,7 @@ import com.spatial4j.core.shape.Point;
 import com.spatial4j.core.shape.Shape;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StoredField;
 import org.apache.lucene.document.StringField;
 import org.apache.lucene.index.IndexableField;
 import org.apache.lucene.search.FilteredQuery;
@@ -197,7 +198,7 @@ public class PortedSolr3Test extends Str
       doc.add(f);
     }
     if (storeShape)
-      doc.add(strategy.createStoredField(shape));
+      doc.add(new StoredField(strategy.getFieldName(), ctx.toString(shape)));
     return doc;
   }
 

Modified: lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java?rev=1360029&r1=1360028&r2=1360029&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java Wed Jul 11 06:29:50 2012
@@ -24,6 +24,7 @@ import com.spatial4j.core.io.sample.Samp
 import com.spatial4j.core.shape.Shape;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StoredField;
 import org.apache.lucene.document.StringField;
 import org.apache.lucene.index.IndexableField;
 import org.apache.lucene.spatial.query.SpatialArgsParser;
@@ -89,7 +90,7 @@ public abstract class StrategyTestCase e
         }
       }
       if (storeShape)
-        document.add(strategy.createStoredField(shape));
+        document.add(new StoredField(strategy.getFieldName(), ctx.toString(shape)));
 
       documents.add(document);
     }

Modified: lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java?rev=1360029&r1=1360028&r2=1360029&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java (original)
+++ lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java Wed Jul 11 06:29:50 2012
@@ -26,6 +26,7 @@ import com.spatial4j.core.shape.simple.P
 import com.spatial4j.core.util.GeohashUtils;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StoredField;
 import org.apache.lucene.document.StringField;
 import org.apache.lucene.index.IndexableField;
 import org.apache.lucene.spatial.SpatialMatchConcern;
@@ -157,7 +158,7 @@ public class TestRecursivePrefixTreeStra
       doc.add(f);
     }
     if (storeShape)
-      doc.add(strategy.createStoredField(shape));
+      doc.add(new StoredField(strategy.getFieldName(), ctx.toString(shape)));
     return doc;
   }
 

Modified: lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java?rev=1360029&r1=1360028&r2=1360029&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java (original)
+++ lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java Wed Jul 11 06:29:50 2012
@@ -23,6 +23,7 @@ import com.spatial4j.core.shape.Shape;
 import com.spatial4j.core.shape.simple.PointImpl;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StoredField;
 import org.apache.lucene.document.StringField;
 import org.apache.lucene.spatial.SpatialTestCase;
 import org.apache.lucene.spatial.prefix.tree.QuadPrefixTree;
@@ -45,7 +46,7 @@ public class TestTermQueryPrefixGridStra
     Document losAngeles = new Document();
     losAngeles.add(new StringField("name", "Los Angeles", Field.Store.YES));
     losAngeles.add(prefixGridStrategy.createField(point));
-    losAngeles.add(prefixGridStrategy.createStoredField(point));
+    losAngeles.add(new StoredField(prefixGridStrategy.getFieldName(), ctx.toString(point)));
 
     addDocumentsAndCommit(Arrays.asList(losAngeles));