browse a facet without a query?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

browse a facet without a query?

jenix
When there is no "q" Solr complains. How can I browse a facet without
a keyword query? For example, I want to view all document for a given state;

?q=&fq=state:California

Thank you.
Jennifer Seaman  
Reply | Threaded
Open this post in threaded view
|

Re: browse a facet without a query?

Yonik Seeley-2
On 4/23/07, Jennifer Seaman <[hidden email]> wrote:
> When there is no "q" Solr complains. How can I browse a facet without
> a keyword query? For example, I want to view all document for a given state;
>
> ?q=&fq=state:California

With a relatively recent nightly build, you can use q=*:*
Before that, use an open-ended range query like q=state:[* TO *]

-Yonik
Reply | Threaded
Open this post in threaded view
|

Re: browse a facet without a query?

TomSolrList
Hi -

On 4/23/07, Yonik Seeley <[hidden email]> wrote:

>
> On 4/23/07, Jennifer Seaman <[hidden email]> wrote:
> > When there is no "q" Solr complains. How can I browse a facet without
> > a keyword query? For example, I want to view all document for a given
> state;
> >
> > ?q=&fq=state:California
>
> With a relatively recent nightly build, you can use q=*:*
> Before that, use an open-ended range query like q=state:[* TO *]


I was doing the q=state[* TO *] for a short time, and found it very slow. I
switched to doing a query on a single field that covered the part of the
index I was interested in, for example:

inStock:true

And got much faster performance. I was getting execution times in seconds
(for example, I just manually did this and got. 2.2 seconds for the [* TO
*], and 50 milliseconds for the latter (inStock:true), uncached)

In my case the filter query hits about 80% of the docs, so it's doing a
similar amount of work. I don't know how well *:* performs, but if it is
similar to state:[* TO *], I would benchmark it before using.

For us, facet queries are a high percentage, so the time was critical. It
might even be worth adding a field, if you don't already have an appropriate
one.

Tom
Reply | Threaded
Open this post in threaded view
|

Re: browse a facet without a query?

Chris Hostetter-3

: I was doing the q=state[* TO *] for a short time, and found it very slow. I
: switched to doing a query on a single field that covered the part of the
: index I was interested in, for example:
:
: inStock:true

if you have the filterCache enabled and you aren't opening new searchers
very often, the open ended range query should results in a cached bitself
just as good as something like inStock:true ... i think yonik just
suggested it because if you are faceting on state then you can be
confident that you are only interested in docs that have a state field.

: And got much faster performance. I was getting execution times in seconds
: (for example, I just manually did this and got. 2.2 seconds for the [* TO
: *], and 50 milliseconds for the latter (inStock:true), uncached)

[* TO *] on the default field might be very slow (because it's iterating
over all the terms) but on a field with a small number of discrete values
(like state, or inStock) it should be very fast.

: similar amount of work. I don't know how well *:* performs, but if it is
: similar to state:[* TO *], I would benchmark it before using.

*:* is implemented extremeley efficienlty ... it doesn't look at any term
info, it just iterates over all the non-deleted docs.



-Hoss

Reply | Threaded
Open this post in threaded view
|

Re: browse a facet without a query?

Yonik Seeley-2
In reply to this post by TomSolrList
On 4/23/07, Tom Hill <[hidden email]> wrote:
> I was doing the q=state[* TO *] for a short time, and found it very slow. I
> switched to doing a query on a single field that covered the part of the
> index I was interested in, for example:
>
> inStock:true
>
> And got much faster performance.

Good point... the fewer the terms, the faster the performance.

> I don't know how well *:* performs, but if it is
> similar to state:[* TO *], I would benchmark it before using.

*:* will be the fastest as it translates to a MatchAllDocsQuery, which
does no term lookups at all, but just skips over deleted documents.

-Yonik