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 Liam O'Boyle <li...@intelligencebank.com> on 2010/02/24 06:54:12 UTC
Date Facets
Afternoon,
I have a strange problem occurring with my date faceting. I seem to
have more results in my facets than in my actual result set.
The query filters by date to show results for one year, i.e.
ib_date:[2000-01-01T00:00:00Z TO 2000-12-31T23:59:59Z], then uses date
faceting to break up the dates by month, using the following parameters
facet=true
facet.date=ib_date
facet.date.start=2000-01-01T00:00:00Z
facet.date.end=2000-12-31T23:59:59Z
facet.date.gap=+1MONTH
However, I end up with more numbers in the facets than there are
documents in the response, including facets for dates that aren't
matched. See below for a summary of the results pulled out
through /solr/select.
<result name="response" numFound="4" start="0">
-
<doc>
<date name="ib_date">2000-12-01T00:00:00Z</date>
</doc>
−
<doc>
<date name="ib_date">2000-08-01T00:00:00Z</date>
</doc>
−
<doc>
<date name="ib_date">2000-06-01T00:00:00Z</date>
</doc>
−
<doc>
<date name="ib_date">2000-11-01T00:00:00Z</date>
</doc>
</result>
−
<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields"/>
−
<lst name="facet_dates">
−
<lst name="ib_date">
<int name="2000-01-01T00:00:00Z">0</int>
<int name="2000-02-01T00:00:00Z">0</int>
<int name="2000-03-01T00:00:00Z">0</int>
<int name="2000-04-01T00:00:00Z">0</int>
<int name="2000-05-01T00:00:00Z">1</int>
<int name="2000-06-01T00:00:00Z">1</int>
<int name="2000-07-01T00:00:00Z">1</int>
<int name="2000-08-01T00:00:00Z">1</int>
<int name="2000-09-01T00:00:00Z">0</int>
<int name="2000-10-01T00:00:00Z">1</int>
<int name="2000-11-01T00:00:00Z">2</int>
<int name="2000-12-01T00:00:00Z">1</int>
<str name="gap">+1MONTH</str>
<date name="end">2001-01-01T00:00:00Z</date>
</lst>
</lst>
</lst>
Is there something I'm missing here?
Thanks,
Liam
Re: Date Facets
Posted by gwk <gi...@eyefi.nl>.
Hi Liam,
This happens because the range searches for date faceting are inclusive
on both ends. So values on the exact edges of the intervals are counted
twice. You can see some solutions at
http://old.nabble.com/Date-Faceting-and-Double-Counting-td25227846.html
Regards,
gwk
On 2/24/2010 6:54 AM, Liam O'Boyle wrote:
> Afternoon,
>
> I have a strange problem occurring with my date faceting. I seem to
> have more results in my facets than in my actual result set.
>
> The query filters by date to show results for one year, i.e.
> ib_date:[2000-01-01T00:00:00Z TO 2000-12-31T23:59:59Z], then uses date
> faceting to break up the dates by month, using the following parameters
>
> facet=true
> facet.date=ib_date
> facet.date.start=2000-01-01T00:00:00Z
> facet.date.end=2000-12-31T23:59:59Z
> facet.date.gap=+1MONTH
>
> However, I end up with more numbers in the facets than there are
> documents in the response, including facets for dates that aren't
> matched. See below for a summary of the results pulled out through
> /solr/select.
>
> Is there something I'm missing here?
>
> Thanks,
> Liam
Re: Date Facets
Posted by Liam O'Boyle <li...@gmail.com>.
In response to myself,
The problem occurs because the date ranges are inclusive. I can fix
this by making facet.date.gap = +1MONTH-1SECOND, but is there a way to
specify that the upper bound is exclusive, rather than inclusive?
Liam
On Wed, 2010-02-24 at 16:54 +1100, Liam O'Boyle wrote:
> Afternoon,
>
> I have a strange problem occurring with my date faceting. I seem to
> have more results in my facets than in my actual result set.
>
> The query filters by date to show results for one year, i.e.
> ib_date:[2000-01-01T00:00:00Z TO 2000-12-31T23:59:59Z], then uses date
> faceting to break up the dates by month, using the following
> parameters
>
> facet=true
> facet.date=ib_date
> facet.date.start=2000-01-01T00:00:00Z
> facet.date.end=2000-12-31T23:59:59Z
> facet.date.gap=+1MONTH
>
> However, I end up with more numbers in the facets than there are
> documents in the response, including facets for dates that aren't
> matched. See below for a summary of the results pulled out
> through /solr/select.
>
> <result name="response" numFound="4" start="0">
> -
> <doc>
> <date name="ib_date">2000-12-01T00:00:00Z</date>
> </doc>
> −
> <doc>
> <date name="ib_date">2000-08-01T00:00:00Z</date>
> </doc>
> −
> <doc>
> <date name="ib_date">2000-06-01T00:00:00Z</date>
> </doc>
> −
> <doc>
> <date name="ib_date">2000-11-01T00:00:00Z</date>
> </doc>
> </result>
> −
> <lst name="facet_counts">
> <lst name="facet_queries"/>
> <lst name="facet_fields"/>
> −
> <lst name="facet_dates">
> −
> <lst name="ib_date">
> <int name="2000-01-01T00:00:00Z">0</int>
> <int name="2000-02-01T00:00:00Z">0</int>
> <int name="2000-03-01T00:00:00Z">0</int>
> <int name="2000-04-01T00:00:00Z">0</int>
> <int name="2000-05-01T00:00:00Z">1</int>
> <int name="2000-06-01T00:00:00Z">1</int>
> <int name="2000-07-01T00:00:00Z">1</int>
> <int name="2000-08-01T00:00:00Z">1</int>
> <int name="2000-09-01T00:00:00Z">0</int>
> <int name="2000-10-01T00:00:00Z">1</int>
> <int name="2000-11-01T00:00:00Z">2</int>
> <int name="2000-12-01T00:00:00Z">1</int>
> <str name="gap">+1MONTH</str>
> <date name="end">2001-01-01T00:00:00Z</date>
> </lst>
> </lst>
> </lst>
>
> Is there something I'm missing here?
>
> Thanks,
> Liam