O
O
oowl2012-09-10 13:30:54
MySQL
oowl, 2012-09-10 13:30:54

How to group by date in Sphinxsearch with TZ?

It is necessary to find documents by grouping them by calendar day, but each request comes from users from different time zones. Functions like YEARMONTHDAY() use the server's current TZ. When searching, you cannot write your own callback, in which you could add a time shift to the date of the document.

There is an idea about a terribly crutch solution: specify as many mysql selection pseudo-fields in source as there are timezones. In each of them, recalculate the date of the document at the time of the desired TZ relative to the TZ server. When selecting, group by the field that corresponds to the desired TZ. In addition to the fact that the solution is simply terrible, it is also bad because the data is only relevant at the time the index is built, and in a second it may no longer be relevant.

Are there solutions?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question