datetime - Solr: Opening hours, whats open now -
i have looked around everywhere, not find single place gives answer, there many places ideas shared no actual end end example/solution given.
what need simple, have bunch of restaurants have opening hours each restaurant have different opening hours in day (i.e open 9-11, 13-15 , maybe 18-21) each place have different schedule per days of week, lets on weekends , wednesdays half day.
my data in db stored below:
|restaurant id| day of week | open time |close time| |pizza123 | 1 | 0800 | 1100 | |pizza123 | 1 | 1300 | 1500 | |pizza123 | 1 | 1700 | 2100 | |pizza123 | 2 | 0800 | 1500 | |pizza123 | 2 | 1800 | +0200 | .......
from read need consider solrs spatialfortimedurations, explains me following:
- i store opening time x
- i store closing time y
- which expressed x y (x space y)
- i supply these values string solr
- these values should supplied field of type solr.spatialrecursiveprefixtreefieldtype
this far have gotten.
below questions:
what day of week? solves problem opening/closing hours
how query place thats open "now"?
how query place open next hour or tomorrow noon?
how deal opening hours span across 2 days, see last example in sample db table above.
please share sample queries can wrap head around
please let me know there else missing
many thanks
so have managed resolve this, interested answer can found here http://wiki.apache.org/solr/daterangefield
Comments
Post a Comment