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 Tim Christensen <ti...@vanns.net> on 2011/02/28 00:41:38 UTC

Facet Query Question

Hi,

I am trying to do the following:

Where a query might return:

Facet 1
A
B
C

Facet 2
X
Y
Z

User selects Facet 1 option A. Normally this paradigm would contract the results as in a refining paradigm. That would be fine and the obvious UI change. But by doing so, Facet 2 option X is no longer available -- again because of the refining. Let's say I still wanted Facet 2 option X to be available to instead of refining, expands the results.

Normally, my query might look like:

q=query&fq=Facet 1:A (for the first part of my question. What I have done is return two sets of facet results, one for the main query and one for the refined query. That way I can still offer option X. What I don't know how to do is query beyond that. I have tried some ORs and ANDs  in my unit tests, but don't think this is the right way.

My question is whether there is a way in a single query to bring back all the original facets regardless of any facet refining. If not, give that I return two sets of facets - a refined set and the 'original' querys' facet set, how would I fashion this query?

My apologies if this is rookie, I have a few years of Solr under my belt, but can't think outside the refining and then expanding the result set with a facet query that was available in the original query results.

Thank you,

Tim Christensen







Re: Facet Query Question

Posted by Rob Casson <ro...@gmail.com>.
if i'm understanding your question, it sounds like
localparams/tagging/exclusion might be what you want:

     http://wiki.apache.org/solr/SimpleFacetParameters#Multi-Select_Faceting_and_LocalParams

hth,
rob

On Sun, Feb 27, 2011 at 6:41 PM, Tim Christensen
<ti...@vanns.net> wrote:
> Hi,
>
> I am trying to do the following:
>
> Where a query might return:
>
> Facet 1
> A
> B
> C
>
> Facet 2
> X
> Y
> Z
>
> User selects Facet 1 option A. Normally this paradigm would contract the results as in a refining paradigm. That would be fine and the obvious UI change. But by doing so, Facet 2 option X is no longer available -- again because of the refining. Let's say I still wanted Facet 2 option X to be available to instead of refining, expands the results.
>
> Normally, my query might look like:
>
> q=query&fq=Facet 1:A (for the first part of my question. What I have done is return two sets of facet results, one for the main query and one for the refined query. That way I can still offer option X. What I don't know how to do is query beyond that. I have tried some ORs and ANDs  in my unit tests, but don't think this is the right way.
>
> My question is whether there is a way in a single query to bring back all the original facets regardless of any facet refining. If not, give that I return two sets of facets - a refined set and the 'original' querys' facet set, how would I fashion this query?
>
> My apologies if this is rookie, I have a few years of Solr under my belt, but can't think outside the refining and then expanding the result set with a facet query that was available in the original query results.
>
> Thank you,
>
> Tim Christensen
>
>
>
>
>
>
>

Re: Facet Query Question

Posted by Tim Christensen <ti...@vanns.net>.
Sorry. It was hand typed, it is the other way around. It is part of the actual, but I did not copy and paste it.

q=query&fq={!tag=cat}categories:Jackets&fq={!tag=adv}adventures:Camping&facet.field={!ex=cat}categories&facet.field={!ex=adv}adventures

On Feb 27, 2011, at 5:48 PM, Yonik Seeley wrote:

> On Sun, Feb 27, 2011 at 7:32 PM, Tim Christensen
> <ti...@vanns.net> wrote:
>> q=query&fq={!ex=cat}categories:Jackets&fq={!ex=adv}adventures:Camping&facet.field={!tag=cat}categories&facet.field={!tag=adv}adventures
> 
> If this is the actual command you used, it looks like you switched
> "ex" and "tag"?
> 
> -Yonik
> http://lucidimagination.com




Re: Facet Query Question

Posted by Tim Christensen <ti...@vanns.net>.
My actual:

INFO: [] webapp=null path=/select params={timeAllowed=30000&qt=dismax&q=columbia&rows=1&facet.field={!ex%3Dcat}categories&facet.field={!ex%3Dadv}adventures&facet=true&facet.limit=-1&facet.mincount=1&fq={!tag%3Dcat}categories:Boots&fq={!tag%3Dadv}adventures:Camping} hits=1 status=0 QTime=1

On Feb 27, 2011, at 5:48 PM, Yonik Seeley wrote:

> On Sun, Feb 27, 2011 at 7:32 PM, Tim Christensen
> <ti...@vanns.net> wrote:
>> q=query&fq={!ex=cat}categories:Jackets&fq={!ex=adv}adventures:Camping&facet.field={!tag=cat}categories&facet.field={!tag=adv}adventures
> 
> If this is the actual command you used, it looks like you switched
> "ex" and "tag"?
> 
> -Yonik
> http://lucidimagination.com


-------------------------------------------------
Tim Christensen
Director Media & Technology
Vann's Inc.
406-203-4656

http://www.vanns.com

Follow me on Twitter: http://twitter.com/tim_christensen
tim@vanns.com

Follow Vann's on Twitter: http://twitter.com/vanns

This e-mail and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. This communication may contain material protected by the attorney-client privilege. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please immediately notify Tim Christensen by telephone at 406-203-4656. You will be reimbursed for reasonable costs incurred in notifying us.







Re: Facet Query Question

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Sun, Feb 27, 2011 at 7:32 PM, Tim Christensen
<ti...@vanns.net> wrote:
> q=query&fq={!ex=cat}categories:Jackets&fq={!ex=adv}adventures:Camping&facet.field={!tag=cat}categories&facet.field={!tag=adv}adventures

If this is the actual command you used, it looks like you switched
"ex" and "tag"?

-Yonik
http://lucidimagination.com

Re: Facet Query Question

Posted by Tim Christensen <ti...@vanns.net>.
Okay -- so I did see that before and I tested it. It does work for example when I do this:

q=query&fq={!ex=cat}categories:Jackets&facet.field={!tag=cat}categories

Thank you for that part. What I don't get is any of the other facet fields returning their full list of values. So in my case I need all the facets to bring back all their options.

It seems that only if I query on a field with the tag and ex filters it works for that set of facets. So in my previous example if I queried facet 1 and refined facet 2 by default, but still want all of facet 2.

When I do this one (there is more to this, this is just to abbreviate the example):

q=query&fq={!ex=cat}categories:Jackets&fq={!ex=adv}adventures:Camping&facet.field={!tag=cat}categories&facet.field={!tag=adv}adventures

It does a refine so that the facets for categories and the facets for adventures go back to being restrained.

If this is solved, my next problem is how to do the multi-select query so that if I did have all of categories or adventures returning like I want, when two or more of each are selected, what does the filter query look like?

Thank you, I am amazed at this list and the responsiveness.

Tim

On Feb 27, 2011, at 4:55 PM, Jan Høydahl wrote:

> Hi,
> 
> LocalParam {!tag} and {!ex} will help you:
> http://wiki.apache.org/solr/SimpleFacetParameters#Tagging_and_excluding_Filters
> 
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
> 
> On 28. feb. 2011, at 00.41, Tim Christensen wrote:
> 
>> Hi,
>> 
>> I am trying to do the following:
>> 
>> Where a query might return:
>> 
>> Facet 1
>> A
>> B
>> C
>> 
>> Facet 2
>> X
>> Y
>> Z
>> 
>> User selects Facet 1 option A. Normally this paradigm would contract the results as in a refining paradigm. That would be fine and the obvious UI change. But by doing so, Facet 2 option X is no longer available -- again because of the refining. Let's say I still wanted Facet 2 option X to be available to instead of refining, expands the results.
>> 
>> Normally, my query might look like:
>> 
>> q=query&fq=Facet 1:A (for the first part of my question. What I have done is return two sets of facet results, one for the main query and one for the refined query. That way I can still offer option X. What I don't know how to do is query beyond that. I have tried some ORs and ANDs  in my unit tests, but don't think this is the right way.
>> 
>> My question is whether there is a way in a single query to bring back all the original facets regardless of any facet refining. If not, give that I return two sets of facets - a refined set and the 'original' querys' facet set, how would I fashion this query?
>> 
>> My apologies if this is rookie, I have a few years of Solr under my belt, but can't think outside the refining and then expanding the result set with a facet query that was available in the original query results.
>> 
>> Thank you,
>> 
>> Tim Christensen
>> 
>> 
>> 
>> 
>> 
>> 



Re: Facet Query Question

Posted by Jan Høydahl <ja...@cominvent.com>.
Hi,

LocalParam {!tag} and {!ex} will help you:
http://wiki.apache.org/solr/SimpleFacetParameters#Tagging_and_excluding_Filters

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

On 28. feb. 2011, at 00.41, Tim Christensen wrote:

> Hi,
> 
> I am trying to do the following:
> 
> Where a query might return:
> 
> Facet 1
> A
> B
> C
> 
> Facet 2
> X
> Y
> Z
> 
> User selects Facet 1 option A. Normally this paradigm would contract the results as in a refining paradigm. That would be fine and the obvious UI change. But by doing so, Facet 2 option X is no longer available -- again because of the refining. Let's say I still wanted Facet 2 option X to be available to instead of refining, expands the results.
> 
> Normally, my query might look like:
> 
> q=query&fq=Facet 1:A (for the first part of my question. What I have done is return two sets of facet results, one for the main query and one for the refined query. That way I can still offer option X. What I don't know how to do is query beyond that. I have tried some ORs and ANDs  in my unit tests, but don't think this is the right way.
> 
> My question is whether there is a way in a single query to bring back all the original facets regardless of any facet refining. If not, give that I return two sets of facets - a refined set and the 'original' querys' facet set, how would I fashion this query?
> 
> My apologies if this is rookie, I have a few years of Solr under my belt, but can't think outside the refining and then expanding the result set with a facet query that was available in the original query results.
> 
> Thank you,
> 
> Tim Christensen
> 
> 
> 
> 
> 
> 


Re: Facet Query Question

Posted by Ahmet Arslan <io...@yahoo.com>.
> I am trying to do the following:
> 
> Where a query might return:
> 
> Facet 1
> A
> B
> C
> 
> Facet 2
> X
> Y
> Z
> 
> User selects Facet 1 option A. Normally this paradigm would
> contract the results as in a refining paradigm. That would
> be fine and the obvious UI change. But by doing so, Facet 2
> option X is no longer available -- again because of the
> refining. Let's say I still wanted Facet 2 option X to be
> available to instead of refining, expands the results.
> 
> Normally, my query might look like:
> 
> q=query&fq=Facet 1:A (for the first part of my
> question. What I have done is return two sets of facet
> results, one for the main query and one for the refined
> query. That way I can still offer option X. What I don't
> know how to do is query beyond that. I have tried some ORs
> and ANDs  in my unit tests, but don't think this is the
> right way.
> 
> My question is whether there is a way in a single query to
> bring back all the original facets regardless of any facet
> refining. If not, give that I return two sets of facets - a
> refined set and the 'original' querys' facet set, how would
> I fashion this query?
> 
> My apologies if this is rookie, I have a few years of Solr
> under my belt, but can't think outside the refining and then
> expanding the result set with a facet query that was
> available in the original query results.
> 

Sounds like you want multi select faceting?

http://wiki.apache.org/solr/SimpleFacetParameters#Multi-Select_Faceting_and_LocalParams