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 Matthew Runo <mr...@zappos.com> on 2007/09/07 20:47:56 UTC

Return 2 fields per facet.. name and id, for example?

Hello!

I've found something which is either already in SOLR, or should be  
(as I can see it being very helpful). I couldn't figure out how to do  
it though..

Lets say I'm trying to print out a page of products, and I want to  
provide a list of brands to filter by. It would be great if in my  
facets I could get this sort of xml...


<int name="adidas" id="1">45</int>

That way, I'd be able to know the brand id of adidas without having  
to run a second query somewhere for each facet to look it up. Without  
having this, I'd have to pass &fq=brand:adidas to make this work, and  
with some brands having strange character's in their names.. éS, for  
example, passing the name in the URL can be annoying =p

Any way to do this?

+--------------------------------------------------------+
  | Matthew Runo
  | Zappos Development
  | mruno@zappos.com
  | 702-943-7833
+--------------------------------------------------------+



Re: Return 2 fields per facet.. name and id, for example?

Posted by Matthew Runo <mr...@zappos.com>.
Ahh... sneaky. I'll probably do the combined-name#id method.

+--------------------------------------------------------+
  | Matthew Runo
  | Zappos Development
  | mruno@zappos.com
  | 702-943-7833
+--------------------------------------------------------+


On Sep 7, 2007, at 12:38 PM, Yonik Seeley wrote:

> On 9/7/07, Matthew Runo <mr...@zappos.com> wrote:
>> I've found something which is either already in SOLR, or should be
>> (as I can see it being very helpful). I couldn't figure out how to do
>> it though..
>>
>> Lets say I'm trying to print out a page of products, and I want to
>> provide a list of brands to filter by. It would be great if in my
>> facets I could get this sort of xml...
>>
>>
>> <int name="adidas" id="1">45</int>
>>
>> That way, I'd be able to know the brand id of adidas without having
>> to run a second query somewhere for each facet to look it up.
>
> If you can get the name from the id in your webapp, then index the id
> to begin with (instead of the name).
> <int name="1">45</int>
>
>  Or, if you need both the name and the id, index them both together,
> separated by a special character that you can strip out on the webapp
> side...
>
> <int name="adidas#1">45</int>
>
> -Yonik
>


Re: Return 2 fields per facet.. name and id, for example?

Posted by Yonik Seeley <yo...@apache.org>.
On 9/7/07, Matthew Runo <mr...@zappos.com> wrote:
> I've found something which is either already in SOLR, or should be
> (as I can see it being very helpful). I couldn't figure out how to do
> it though..
>
> Lets say I'm trying to print out a page of products, and I want to
> provide a list of brands to filter by. It would be great if in my
> facets I could get this sort of xml...
>
>
> <int name="adidas" id="1">45</int>
>
> That way, I'd be able to know the brand id of adidas without having
> to run a second query somewhere for each facet to look it up.

If you can get the name from the id in your webapp, then index the id
to begin with (instead of the name).
<int name="1">45</int>

 Or, if you need both the name and the id, index them both together,
separated by a special character that you can strip out on the webapp
side...

<int name="adidas#1">45</int>

-Yonik