Hello again Geert-Jan!

What you're trying to do is indeed possible with Solr 4 out of the box. 
Other terminology people use for this is multi-value time duration.  This
creative solution is a pure application of spatial without the geospatial
notion -- we're not using an earth or other sphere model -- it's a flat
plane.  So no need to make reference to longitude & latitude, it's x & y.

I would put opening time into x, and closing time into y.  To express a
point, use "x y" (x space y), and supply this as a string to your
SpatialRecursivePrefixTreeFieldType based field for indexing.  You can give
it multiple values and it will work correctly; this is one of RPT's main
features that set it apart from Solr 3 spatial.  To query for a business
that is open during at least some part of a given time duration, say 6-8
o'clock, the query would look like openDuration:"Intersects(minX minY maxX
maxY)"  and put 0 or minX (always), 6 for minY (start time), 8 for maxX (end
time), and the largest possible value for maxY.  You wouldn't actually use 6
& 8, you'd use the number of 15 minute intervals since your epoch for this
equivalent time span.

You'll need to configure the field correctly: geo="false" worldBounds="0 0
maxTime maxTime" substituting an appropriate value for maxTime based on your
unit of time (number of 15 minute intervals you need) and distErrPct="0"
(full precision).

Let me know how this works for you.

~ David



-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: 
http://lucene.472066.n3.nabble.com/Modeling-openinghours-using-multipoints-tp4025336p4025359.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to