|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Date Facet Giving Count more than actualhi guys,
I am indexing events in solr, where every Event contains a startDate and endDate. On the search page, I would like to have a Date Facet where users can quickly browse through dates they are interested in. I have a field daysForFilter in each document which stores timestamps from today till endDate as yyyy-MM-ddT00:00:01Z. The reason I have kept 01 seconds is to avoid overlap between two dates when calculating facets. My application works on IST time zone, thus date 2009-10-24 00:00:00 is stored in solr as 2009-10-23 18:30:00. I am using Date Faceting on this field, and the date facet query is something like this. q=<something>&facet=true&facet.date=daysForFilter&facet.date.start=2009-10-23T18:30:01Z&facet.date.gap=%2B1DAY&facet.date.end=2009-10-28T18:30:01Z Ideally I should get correct date facets with count of events occuring on that date. But for some dates I get count more that existing in the result. For example I get total 18 documents for my query, and the facet count for date 2009-10-23T18:30:01Z is 11; whereas there are only 5 documents containing this field value. I have verified this in result. Also when I query for daysForFilter:2009-10-23T18:30:01Z, it gives me 5 results. I am really helpless with this problem, and do not understand why its generating such wrong facets. It would be great if any one can guide me further. regards, aakash |
|
|
Re: Date Facet Giving Count more than actual: q=<something>&facet=true&facet.date=daysForFilter&facet.date.start=2009-10-23T18:30:01Z&facet.date.gap=%2B1DAY&facet.date.end=2009-10-28T18:30:01Z : For example I get total 18 documents for my query, and the facet count for : date 2009-10-23T18:30:01Z is 11; whereas there are only 5 documents : containing this field value. I have verified this in result. Also when I : query for daysForFilter:2009-10-23T18:30:01Z, it gives me 5 results. I think you are missunderstanding what date faceting does. you have a facet.date.gap of +1DAY, which means the facet count is anything between 2009-10-23T18:30:01Z and 2009-10-24T18:30:01Z inclusively. you can verify this using a range query (not a term query) ... daysForFilter:[2009-10-23T18:30:01Z TO 2009-10-23T18:30:01Z+1DAY] if you only want to facet on a unique moment in time (not a range) then you cna use facet.query ... or you can set the facet gap smaller. you should also take a look at facet.date.hardend... http://wiki.apache.org/solr/SimpleFacetParameters#facet.date.hardend -Hoss |
|
|
Re: Date Facet Giving Count more than actualThanks Hoss, the problem is resolved.
The real problem was my query parameter. I was storing daysForFilter with offset of 1 sec, and date in query parameter "facet.date.start" also had same offset. This was causing the overlaps, as in the facet value of 2009-10-23T18:30:01 was matching both 2009-10-23T18:30:01 and 2009-10-24T18:30:01. just changing the query to "q=<something>&facet=true&facet.date=daysForFilter&facet.date.start=2009-10-23T18:30:00Z&facet.date.gap=%2B1DAY&facet.date.end=2009-10-28T18:30:00Z" works. thanks any way. regards, aakash. On Tue, Nov 3, 2009 at 9:43 PM, Chris Hostetter <hossman_lucene@...>wrote: > > : > q=<something>&facet=true&facet.date=daysForFilter&facet.date.start=2009-10-23T18:30:01Z&facet.date.gap=%2B1DAY&facet.date.end=2009-10-28T18:30:01Z > > : For example I get total 18 documents for my query, and the facet count > for > : date 2009-10-23T18:30:01Z is 11; whereas there are only 5 documents > : containing this field value. I have verified this in result. Also when I > : query for daysForFilter:2009-10-23T18:30:01Z, it gives me 5 results. > > I think you are missunderstanding what date faceting does. you have a > facet.date.gap of +1DAY, which means the facet count is anything between > 2009-10-23T18:30:01Z and 2009-10-24T18:30:01Z inclusively. you can verify > this using a range query (not a term query) ... > > daysForFilter:[2009-10-23T18:30:01Z TO 2009-10-23T18:30:01Z+1DAY] > > if you only want to facet on a unique moment in time (not a range) then > you cna use facet.query ... or you can set the facet gap smaller. > > you should also take a look at facet.date.hardend... > http://wiki.apache.org/solr/SimpleFacetParameters#facet.date.hardend > > > -Hoss > > |
| Free embeddable forum powered by Nabble | Forum Help |