Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change 
notification.

The "SolrAdaptersForLuceneSpatial4" page has been changed by DavidSmiley:
http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4?action=diff&rev1=7&rev2=8

                 units="degrees"
              />
  }}}
- The XML attributes are parameters for configuring the field type:
-  * spatialContextFactory: If polygons or other WKT formatted shape support is 
needed, then use the JTS based class as shown above, otherwise this can be 
omitted.  The JTS jar file must be on Solr's classpath as well.  Due to a 
combination of things, JTS can't simply be referenced by a "<lib>" entry in 
solrconfig.xml; it needs to be in WEB-INF/lib in Solr's war file, basically. 
-  * distErrPct="0.025": When indexing shapes other than points, this is used 
to specify the default precision of a shape's area which is basically pixelated 
on an indexed grid.  This number is approximated as the fraction of the 
distance between the center of a shape and the farthest corner of its bounding 
box.  As a fraction it is between 0 and 1, although this one is capped at 0.5.  
The closer this number is to zero, the more accurate the shape will be but it 
will use more disk space and it will take longer to index.
-  * maxDistErr="0.000009": The highest level of detail required for indexed 
data.  If you specify nothing then it is an amount equivalent to a meter -- 
which is just a hair less than 0.000009 degrees.  The units of this are as 
indicated in the "units" attribute.  The actual detail will generally by 
somewhat more precise than this.  Internally, this number is used to derive a 
"maxLevels" trie length for the trie encoding used, which is logged at startup.
-  * units="degrees": This parameter is mandatory, and currently the only value 
supported is "degrees".  This affects the interpretation of maxDistErr, circle 
radius distances, and other absolute distances.  There are approximately 111.2 
kilometers in a degree, based on the average earth radius.
- 
- For non-geospatial uses, there are some other attributes to be aware of:
-  * geo="false": Set geospatial to false. It defaults to true.   By setting it 
to false, you really should indicate worldBounds and probably maxDistErr as 
well.
-  * worldBounds="minX minY maxX maxY": Set the valid numerical ranges for x & 
y.  By default for non-geospatial this is the limits of a Java double however 
those values have been shown to not work (yet).
- 
- There are other parameters too:
-  * distCalculator="haversine": Set the distance calculation algorithm. Others 
are: lawOfCosines (warning: faulty), vincentySphere, cartesian, and cartesian^2.
-  * prefixTree="geohash": Choose the spatial grid implementation.  "geohash" 
uses the Geohash algorithm which has 32 children at each level, and there is 
"quad" which has 4 children from each level, and supports non-geospatial 
(geo=false).
-  * maxLevels="10": Set the maximum level (aka grid depth).  It's easier to 
think in terms of a real distance and use maxDistErr instead.
  
  And finally, specify a field that uses this field type:
  {{{   <field name="geo"  type="location_rpt"  indexed="true" stored="true"  
multiValued="true" />  }}}
@@ -62, +48 @@

  A key feature of the new spatial module is multi-value support but you 
certainly aren't required to declare the field multiValued if it isn't.
  
  
+ The following configuration attributes are common to all new spatial field 
types based on Lucene 4 spatial:
+ 
+  * spatialContextFactory: (Spatial4j) If polygons or other WKT formatted 
shape support is needed, then use the JTS based class as shown above, otherwise 
this can be omitted.  The JTS jar file must be on Solr's classpath as well.  
Due to a combination of things, JTS can't simply be referenced by a "<lib>" 
entry in solrconfig.xml; it needs to be in WEB-INF/lib in Solr's war file, 
basically. 
+  * units="degrees": This parameter is mandatory, and currently the only value 
supported is "degrees".  This affects the interpretation of the maxDistErr 
attribute, circle radius distances, and other absolute distances.  There are 
approximately 111.2 kilometers in a degree, based on the average earth radius.
+  * geo="true": Wether the spatial fields' coordinates are latitude / 
longitude WGS84 based (if true) or whether they are pure Euclidean / Cartesian 
based.  It defaults to true.  When set to false, you should indicate 
worldBounds and probably maxDistErr as well.
+  * worldBounds="minX minY maxX maxY": Set the valid numerical ranges for x & 
y.  If geo="true" then this is assumed "-180 -90 180 90".  When geo="false" 
this is the limits of a Java double however those values have been shown to not 
work (yet), so definitely choose your boundaries for non-geospatial uses.
+  * distCalculator="haversine": Set the distance calculation algorithm.  If 
geo="true" then haversine is the default, otherwise cartesian is.  The possible 
values are: haversine, lawOfCosines (warning: faulty), vincentySphere, 
cartesian, and cartesian^2.
+ 
+ A PrefixTree based field sees the world as a grid.  Each grid cell is further 
decomposed as another set of grid cells at the next level.  The top-most world 
level is known as "level 1", the next detailed is "level 2" and so on. Here are 
the attributes specific to PrefixTree based fields:
+ 
+  * prefixTree="geohash": Choose the spatial grid implementation.  "geohash" 
uses the Geohash algorithm which has 32 children at each level, and its limited 
to use when geo="true".  The other implementation is "quad" which has 4 
children a each level.
+  * maxLevels="10": Set the maximum level (aka grid depth) for indexed data.  
It's easier to think in terms of a real distance and use maxDistErr instead.
+  * maxDistErr="0.000009": The highest level of detail required for indexed 
data.  If you specify nothing then it is a meter -- which is just a hair less 
than 0.000009 degrees.  The units of this attribute are as indicated in the 
"units" attribute.  On initialization, the prefix tree will determine what 
maxLevels should be to satisfy the desired distance precision.  Unless you pick 
a maxDistErr at an exact threshold, the actual distance error will be even more 
precise.  maxLevels is logged at startup.
+  * distErrPct="0.025": Specifies the default precision of non-point shapes, 
as a fraction between 0.0 (fully precise up to maxLevels) and 0.5.  Shapes are 
basically pixelated on an indexed grid.  This number is approximated as the 
fraction of the distance between the center of a shape and the farthest corner 
of its bounding box.  The closer this number is to zero, the more accurate the 
shape will be, but an indexed shape will use more disk space and it will take 
longer to index.  The default is 2.5%.  It applies to both index and query 
shapes, but it is overridable for query shapes.
+ 
+ A couple more obscure attributes are defaultFieldValuesArrayLen (affects 
memory use in distance sorting) and prefixGridScanLevel (tunes heuristics for 
filter performance).
+ 
  == Indexing ==
  
  Points are indexed just as they are in Solr 3 spatial:
+ 
  {{{   <field name="geo">43.17614,-90.57341</field> }}}
  
  If a comma is omitted, then it is in x-y (lon-lat) order:
+ 
  {{{   <field name="geo">-90.57341 43.17614</field> }}}
  
  A lat-lon rectangle can be indexed with 4 numbers in minX minY maxX maxY 
order:
+ 
  {{{   <field name="geo">-74.093 41.042 -69.347 44.558</field> }}}
  
  A circle is specified like so:
+ 
  {{{   <field name="geo">Circle(4.56,1.23 d=0.0710)</field> }}}
  The first part of it is the center point, in either "lon lat" or "lat,lon" 
format, then the "d" distance radius is in degrees.
  
  For polygons, use the WKT standard (Well Known Text) like so:
+ 
  {{{    <field name="geo">POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 
30))</field> }}}
  In WKT, coordinates are in "x y" (lon lat) order, and the coordinates are 
each separated by commas.
  

Reply via email to