You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2009/11/03 17:13:35 UTC

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 actual

Posted by Aakash Dharmadhikari <aa...@gmail.com>.
Thanks 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 <ho...@fucit.org>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
>
>