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/09/17 06:16:28 UTC
svn commit: r1386466 - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/spatial/ lucene/spatial/src/java/org/apache/lucene/spatial/query/
solr/ solr/core/ solr/core/src/java/org/apache/solr/schema/
solr/core/src/java/org/apache/solr/util/ solr/core...
Author: dsmiley
Date: Mon Sep 17 04:16:27 2012
New Revision: 1386466
URL: http://svn.apache.org/viewvc?rev=1386466&view=rev
Log:
SOLR-3304 Solr adapters for the new Lucene 4 spatial module
Added:
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
- copied, changed from r1386457, lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialPrefixTreeFieldType.java
- copied unchanged from r1386457, lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/AbstractSpatialPrefixTreeFieldType.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/SpatialRecursivePrefixTreeFieldType.java
- copied unchanged from r1386457, lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/SpatialRecursivePrefixTreeFieldType.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/SpatialTermQueryPrefixTreeFieldType.java
- copied unchanged from r1386457, lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/SpatialTermQueryPrefixTreeFieldType.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/SpatialTwoDoublesFieldType.java
- copied unchanged from r1386457, lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/SpatialTwoDoublesFieldType.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/util/MapListener.java
- copied unchanged from r1386457, lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/MapListener.java
lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
- copied unchanged from r1386457, lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
- copied unchanged from r1386457, lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
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/query/SpatialArgsParser.java
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/core/ (props changed)
lucene/dev/branches/branch_4x/solr/example/ (props changed)
lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/schema.xml
Modified: lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/query/SpatialArgsParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/query/SpatialArgsParser.java?rev=1386466&r1=1386465&r2=1386466&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/query/SpatialArgsParser.java (original)
+++ lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/query/SpatialArgsParser.java Mon Sep 17 04:16:27 2012
@@ -45,6 +45,9 @@ import java.util.StringTokenizer;
*/
public class SpatialArgsParser {
+ public static final String DIST_ERR_PCT = "distErrPct";
+ public static final String DIST_ERR = "distErr";
+
/** Writes a close approximation to the parsed input format. */
static String writeSpatialArgs(SpatialArgs args) {
StringBuilder str = new StringBuilder();
@@ -90,8 +93,8 @@ public class SpatialArgsParser {
body = v.substring(edx + 1).trim();
if (body.length() > 0) {
Map<String, String> aa = parseMap(body);
- args.setDistErrPct(readDouble(aa.remove("distErrPct")));
- args.setDistErr(readDouble(aa.remove("distErr")));
+ args.setDistErrPct(readDouble(aa.remove(DIST_ERR_PCT)));
+ args.setDistErr(readDouble(aa.remove(DIST_ERR)));
if (!aa.isEmpty()) {
throw new IllegalArgumentException("unused parameters: " + aa, null);
}
Copied: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java (from r1386457, lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java?p2=lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java&p1=lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java&r1=1386457&r2=1386466&rev=1386466&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java Mon Sep 17 04:16:27 2012
@@ -24,7 +24,7 @@ import com.spatial4j.core.shape.Rectangl
import com.spatial4j.core.shape.Shape;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StoredField;
-import org.apache.lucene.index.StorableField;
+import org.apache.lucene.index.IndexableField;
import org.apache.lucene.queries.function.FunctionQuery;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.search.Filter;
@@ -75,12 +75,12 @@ public abstract class AbstractSpatialFie
//--------------------------------------------------------------
@Override
- public final StorableField createField(SchemaField field, Object val, float boost) {
+ public final Field createField(SchemaField field, Object val, float boost) {
throw new IllegalStateException("should be calling createFields because isPolyField() is true");
}
@Override
- public final StorableField[] createFields(SchemaField field, Object val, float boost) {
+ public final Field[] createFields(SchemaField field, Object val, float boost) {
String shapeStr = null;
Shape shape = null;
if (val instanceof Shape) {
@@ -213,7 +213,7 @@ public abstract class AbstractSpatialFie
}
@Override
- public void write(TextResponseWriter writer, String name, StorableField f) throws IOException {
+ public void write(TextResponseWriter writer, String name, IndexableField f) throws IOException {
writer.writeStr(name, f.stringValue(), true);
}
Modified: lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/schema.xml?rev=1386466&r1=1386465&r2=1386466&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/schema.xml (original)
+++ lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/schema.xml Mon Sep 17 04:16:27 2012
@@ -681,11 +681,12 @@
<!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. -->
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
- <!--
- A Geohash is a compact representation of a latitude longitude pair in a single field.
- See http://wiki.apache.org/solr/SpatialSearch
- -->
- <fieldtype name="geohash" class="solr.GeoHashField"/>
+ <!-- An alternative geospatial field type new to Solr 4. It supports multiValued and polygon shapes.
+ For more information about this and other Spatial fields new to Solr 4, see:
+ http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4
+ -->
+ <fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
+ geo="true" distErrPct="0.025" maxDetailDist="0.000009" />
<!-- Money/currency field type. See http://wiki.apache.org/solr/MoneyFieldType
Parameters:
@@ -693,7 +694,7 @@
precisionStep: Specifies the precisionStep for the TrieLong field used for the amount
providerClass: Lets you plug in other exchange provider backend:
solr.FileExchangeRateProvider is the default and takes one parameter:
- currencyConfig: name of an xml file holding exhange rates
+ currencyConfig: name of an xml file holding exchange rates
solr.OpenExchangeRatesOrgProvider uses rates from openexchangerates.org:
ratesFileLocation: URL or path to rates JSON file (default latest.json on the web)
refreshInterval: Number of minutes between each rates fetch (default: 1440, min: 60)