lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "SpatialForTimeDurations" by DavidSmiley
Date Sat, 09 Mar 2013 18:56:39 GMT
Dear Wiki user,

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

The "SpatialForTimeDurations" page has been changed by DavidSmiley:
http://wiki.apache.org/solr/SpatialForTimeDurations?action=diff&rev1=1&rev2=2

Comment:
Fleshed out advise

- If you need to index multi-value time durations (or any numeric ranges) you may be struggling
with how to do this in Solr and search on it properly.  It basically isn't, or should I say,
wasn't possible until Solr 4's new spatial support came along, which supports multi-value
spatial fields.  Usually, "spatial" is nearly synonymous with "geospatial" but it can be used
for other purposes too.
+ If you need to index multi-value time durations (or any numeric ranges) you may be struggling
with how to do this in Solr and search on it properly.  It basically isn't, or should I say,
wasn't possible until Solr 4's new spatial support came along, which supports multi-value
spatial fields.  Usually, "spatial" is nearly synonymous with "geospatial" but it can be used
for other purposes like this too.
  
- First, read Chris Hostetter (aka Hossman)'s slides from a Solr meetup: 
+ First, read Chris Hostetter (aka Hossman)'s illustrated slides from a Solr meetup: 
- [[https://people.apache.org/~hossman/spatial-for-non-spatial-meetup-20130117/|Spatial Search
Tricks for People Who Don't Have Spatial Data]]
+ [[https://people.apache.org/~hossman/spatial-for-non-spatial-meetup-20130117/|Spatial Search
Tricks for People Who Don't Have Spatial Data]].
  
+ == Configuration ==
+ However, don't use the field configuration as given in that presentation, not to mention
there are some tweaks to be done to the queries to avert edge cases.
+ 
+ Here is an example Solr fieldType configuration that may only require some small changes
for your data:
+ 
+ {{{
+ <fieldType name="days_of_year"
+            class="solr.SpatialRecursivePrefixTreeFieldType"
+            multiValued="true"
+            geo="false"
+            worldBounds="0 0 365 365"
+            distErrPct="0"
+            maxDistErr="1"
+            units="degrees"
+         />
+ }}}
+ 
+ Some explanation:
+ * worldBounds: The left two numbers are the starting epoch values (usually 0) and the end
two are the maximum values.  "minX minY maxX maxY" order.  The min and maximums should be
set to the same in the X & Y dimensions.  I'm tempted to suggest using a power of two
large enough for your max value, particularly if you experience any small precision problems.
 But I'm unaware of problems so you don't have to do this.
+ * distErrPct: This use of spatial generally implies precise results, not approximate results.
 Setting distErrPct to 0 means no approximation.
+ * maxDistErr:  This is basically the smallest indivisible value.  This use of spatial should
generally use the integer range to keep things simpler, so use "1".
+ 
+ == Indexing ==
+ 
+ Use "x y" (x space y) order for the points:
+ {{{
+ <doc>
+   ...
+   <field name="shift">1 3</field>
+   ...
+ }}}
+ 
+ == Search ==
+ 
+ Now for queries, look at the examples on Hossman's slides.  '''However''' to avoid edge
cases, you should slightly buffer the query shapes -- the edges other than the minimum or
maximum. One example query given was {{{Intersects(0 9 8 365)}}}  but this should instead
become {{{Intersects(0 8.5 8.5 365)}}}   Math: 9 - 0.5, 8 + 0.5
+ 
+ == Limitations ==
+ 
+ It's not realistic to configure the max values in worldBounds to be a huge number (say Long.MAX_VALUE
2^64^.  Maybe as high as perhaps 2^50^?
+ 
+ == Credit ==
+ 
+ This durration modeling as coordinates idea originated in a solr-user@lucene thread. See
[[http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201212.mbox/%3C1354991310424-4025359.post@n3.nabble.com%3E|David's
initial response to Geert-Jan's question]] and the [[http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201212.mbox/%3C1355027722156-4025434.post@n3.nabble.com%3E|subsequent
followup about using differnt rectangle intersections]].
+ 

Mime
View raw message