lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Combine facet.date and facet.field
Date Mon, 02 Mar 2009 20:14:10 GMT

On Mar 2, 2009, at 10:01 AM, gistolero@gmx.de wrote:
> I'm using the facet.date function to get all matching docs per day:
>
> q
> =
> foo
> &rows
> =
> 0
> &facet
> =
> true
> &facet
> .date
> =
> date
> &facet
> .date
> .start
> =
> 2009
> -01-31T00:00:00Z&facet.date.end=2009-03-01T23:59:59Z&facet.date.gap= 
> +1DAY&fq=+size:big
>
> 2009-01-31T00:00:00Z -> 13 hits
> 2009-02-01T00:00:00Z -> 10 hits
> ...
>
> As you see, the result is filtered by the "fq" parameter. The  
> downside for this solution is that I have to run the query for every  
> value from field "size" (big, small, ...). Is there an easier way to  
> produce the following result with a single query only?
>
> big -> 2009-01-31T00:00:00Z -> 13 hits
> big -> 2009-02-01T00:00:00Z -> 10 hits
> ...
> small -> 2009-01-31T00:00:00Z -> 1 hits
> small -> 2009-02-01T00:00:00Z -> 7 hits
> ...

There is a "tree" faceting component out there that I created still in  
JIRA: http://issues.apache.org/jira/browse/SOLR-792

It works with field faceting (not dates or queries) currently, but is  
along the lines of what you're after.  It'd be great to flesh it out  
to support date ranges and queries.  Under the covers it does just  
what you're doing from a client, but via a single request (but it can  
short circuit a little if the top-level facet has no documents).

	Erik


Mime
View raw message