Hi Péter, There has been a fair amount of discussion on this topic, and there are some pending things being looked at with regards inclusive/exclusive combinations etc.
For today, the easiest way to get the results you want to use a granular time that allows you to specify a non-overlapping period: For example, using milliseconds: [2010-04-2710:00:00.001 TO 2010-04-2711:00:00.000] [2010-04-2711:00:00.001 TO 2010-04-2712:00:00.000] [2010-04-2713:00:00.001 TO 2010-04-2713:00:00.000] You can use whatever date format you want, so long as the stored field has sufficient granularity to define a non-overlapping period. You could equally just do it with seconds: [2010-04-27-10:00:01 TO 2010-04-27-11:00:00] [2010-04-27-11:00:01 TO 2010-04-27-12:00:00] [2010-04-27-12:00:01 TO 2010-04-27-13:00:00] Peter 2010/4/28 Király Péter <pkir...@tesuji.eu> > Grant Ingersoll said: > >> You should be able to do inclusive/exclusive ranges using the query parser >> by >> mixing matching brackets [] and braces {}. >> See >> http://lucene.apache.org/java/2_9_1/queryparsersyntax.html#Range%20Searches >> > > Hi Grant, > > Thanks for your answer, but my problem is not that how to query, but the > content > of facet list. The list's numbers are only true if we use [date1 TO date2] > in query. > If we use {date1 TO date2} in query, the number of results will be wrong. > What is the wrong with that? I should display dates in facet list as > following: > > publication date > 1000-1100 (3) > 1100-1200 (3) > 1200-1300 (12) > ... > as you can see here, the dates are duplicated, the 'to' date wil be the > next 'from' date. > > However it would be more elegant to display something like that: > > publication date > 1000-1099 (2) > 1100-1199 (1) > 1200-1299 (14) > > It would involve, that > <lst name="facet_dates"> > <lst name="date_df"> > > <int name="1000-01-01T00:00:00Z">3</int> > <int name="1100-01-01T00:00:00Z">3</int> > <int name="1200-01-01T00:00:00Z">12</int> > .. > should be understand, that between 1000-01-01T00:00:00Z > and 1100-01-01T00:00:00Z minus 1 sec (or millisec) there are 3 results. > > Grant, from your answer it is clear, that currently no way for the date > facets to > behave like this, but I guess, that it may be an alternative solution. > > Péter >