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 Jamie Johnson <je...@gmail.com> on 2011/08/14 04:00:18 UTC

Date Facet Question

When doing Date faceting I've noticed that if the query is something like:

start: NOW-1YEAR
end: NOW
GAP: +1MONTH

when the response comes back the facet names are

2010-08-14T01:50:58.813Z
2010-09-14T01:50:58.813Z
2010-10-14T01:50:58.813Z
2010-11-14T01:50:58.813Z
2010-12-14T01:50:58.813Z
etc

instead of something like

NOW-11MONTH
NOW-10MONTH
NOW-9MONTH
NOW-8MONTH
etc

where as facet queries if specifying a set of facet queries like

datetime:[NOW-1YEAR TO NOW]
datetime:[NOW-6MONTH TO NOW]
datetime:[NOW-1MONTH TO NOW]
datetime:[NOW-1DAY TO NOW]

the labels come back just as specified.  Is there a way to make date
range queries come back using the query specified and not the parsed
date?

Re: Date Facet Question

Posted by Jamie Johnson <je...@gmail.com>.
Makes complete sense, when faceting on dates I'm just checking to see
if NOW is in it and replace it with either the beginning of the day or
the end of the day (depending if it's lower or upper) and use that.
This works well.  Thanks for the quick response.

On Fri, Aug 19, 2011 at 3:13 PM, Chris Hostetter
<ho...@fucit.org> wrote:
>
> : when the response comes back the facet names are
> :
> : 2010-08-14T01:50:58.813Z
>        ...
> : instead of something like
> :
> : NOW-11MONTH
>        ...
> : where as facet queries if specifying a set of facet queries like
> :
> : datetime:[NOW-1YEAR TO NOW]
>        ...
> : the labels come back just as specified.  Is there a way to make date
> : range queries come back using the query specified and not the parsed
> : date?
>
> No.  If dates were the only factor here we could maybe add an option for
> that but the faceting code is all generalized now to support all numerics,
> so it wouldn't relaly make sense in general.
>
> it's also not clear how an option like this would work if/when stuff like
> SOLR-2366 get implemented - returning the concrete value used as the
> lowerbound of the range is un-ambiguious.
>
> the functional difference between facet.range and facet.query is pretty
> signifigant, so it's kind of an apples/oranges thing to compare their
> output -- with facet.query you can specify any arbitrary query
> expression your heart desires, and that literal unparsed query string
> is again used as the constraint key in the resulting NamedList because
> it's as unambiguious as we can be given the circumstances.
>
>
>
>
> -Hoss
>

Re: Date Facet Question

Posted by Chris Hostetter <ho...@fucit.org>.
: when the response comes back the facet names are
: 
: 2010-08-14T01:50:58.813Z
	...
: instead of something like
: 
: NOW-11MONTH
	...
: where as facet queries if specifying a set of facet queries like
: 
: datetime:[NOW-1YEAR TO NOW]
	...
: the labels come back just as specified.  Is there a way to make date
: range queries come back using the query specified and not the parsed
: date?

No.  If dates were the only factor here we could maybe add an option for 
that but the faceting code is all generalized now to support all numerics, 
so it wouldn't relaly make sense in general.

it's also not clear how an option like this would work if/when stuff like 
SOLR-2366 get implemented - returning the concrete value used as the 
lowerbound of the range is un-ambiguious.

the functional difference between facet.range and facet.query is pretty 
signifigant, so it's kind of an apples/oranges thing to compare their 
output -- with facet.query you can specify any arbitrary query 
expression your heart desires, and that literal unparsed query string 
is again used as the constraint key in the resulting NamedList because 
it's as unambiguious as we can be given the circumstances.




-Hoss