On Wed, Jul 1, 2009 at 10:01 PM, Sumit Aggarwal
<sumit.kaggar...@gmail.com>wrote:

> Hi Shalin,
> specifying facet.query='small'&facet.query=large will actually filter the
> result also.....and it wont give me facet count for both at the same
> time...
> i will give total resultset for both these terms.


No. facet.query will not filter the results. It is applied on top of the
current result set (the documents matching your q and fq parameters). If you
specify multiple facet.query parameters, you will get a count for each of
them.


>  since i am very new to
> solr so i dont understand how facet counting behaves in that case as i have
> seen lots of website showning facet count for multiple terms like amazon
> does ... in amazon if i search laptop on left pane it shows me count of
> each
> brands as well as count of display sizes also but showing total result set
> for query laptop on right section. so they would be doing it.... i am
> assuming this must be some simple task.
>

I guess that's just simple facet.field in play. You have only fixed set of
sizes in your field 'x', so you do a facet.field=x and you get a count for
each term in field 'x'.


>
> Here is example for my req:
> 1. i wanted to search "red dress"...
>
> left section has some filters like size as "small", "large", brands as
> Versace,Marc Jacobs.......
>
> As i fire this query it should return me all result matched  as "red dress"
> on right section and i should get count of small, large, versace, Marc
> Jacobs..... considering i am having all information in a single field as
> descp index field... After that if i select "large" i should get result
> matching as both "red dress" and "large"
>
>
Right, that's stock faceted search. For the scenario you have described, you
can do q=red dress&facet=true&facet.field=size&facet.field=brands and so on
for each field you want to use as a facet.

When a user clicks on a facet value say "versace", you make a query like
q=red dress&*fq=brand:versace*&facet=true&facet.field=size and so on for all
fields you want to use as a facet (note, unless 'brand' is a multi-valued
field, there is no need to include facet.field=brand because a value has
already been selected and facet.field won't match anything)

-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to