Saving date help in Solr

How to save date range in solr?

I need to save the start date and end date.

Suppose this is a villa that is rented during the period (beginning and end).

Should I use two fields correctly?

In the search, the user can select the start date and end date, so when I request solr, I think I can use something like:

     date:[$start TO $end]

But this only asks for one field, which is good, but keeping the date range is my problem.

Hmmmmm.

Any help?

thank

+3
source share
1 answer

Yes, you will need two fields.

Then the request should be in both fields.

Example:

dateFrom:[$start TO $end] AND dateTo:[$start TO $end] 

, , (, 1950-1960 1900-2000).

- , ( ), - :

dateFrom:[* TO $end] AND dateTo:[$start TO *]

.. , . 1900 2000 1950-1960 .

+6

Source: https://habr.com/ru/post/1734850/


All Articles