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 solrdude <yo...@searchreviews.com> on 2011/10/25 02:18:45 UTC

Solr main query response & input to facet query

Hi,
I am implementing an solr solution where I want to use some field values
from main query output as an input in building facet. How do I do that?

Eg: 
Response from main query:

<doc>
<str name="name">name1</str>
<int name="prod_id">200</int>
</doc>
<doc>
<str name="name">name1</str>
<int name="prod_id">400</int>
</doc>

I want to build facet for the query where "prod_id:200 prod_id:400". I like
to do all this in single query ideally. if it can't be done in one query, I
am ok with 2 query as well. Please help.

Thanks

--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-main-query-response-input-to-facet-query-tp3449938p3449938.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr main query response & input to facet query

Posted by lee carroll <le...@googlemail.com>.
Take a look at facet query. You can facet on a query results not just
terms in a field

http://wiki.apache.org/solr/SimpleFacetParameters#facet.query_:_Arbitrary_Query_Faceting



On 25 October 2011 10:56, Erik Hatcher <er...@gmail.com> wrote:
> I'm not following exactly what you're looking for here, but sounds like you want to facet on name... &facet=on&facet.field=name1
>
> and then to filter on a selected one, you can use fq=name:name1
>
>        Erik
>
> On Oct 24, 2011, at 20:18 , solrdude wrote:
>
>> Hi,
>> I am implementing an solr solution where I want to use some field values
>> from main query output as an input in building facet. How do I do that?
>>
>> Eg:
>> Response from main query:
>>
>> <doc>
>> <str name="name">name1</str>
>> <int name="prod_id">200</int>
>> </doc>
>> <doc>
>> <str name="name">name1</str>
>> <int name="prod_id">400</int>
>> </doc>
>>
>> I want to build facet for the query where "prod_id:200 prod_id:400". I like
>> to do all this in single query ideally. if it can't be done in one query, I
>> am ok with 2 query as well. Please help.
>>
>> Thanks
>>
>> --
>> View this message in context: http://lucene.472066.n3.nabble.com/Solr-main-query-response-input-to-facet-query-tp3449938p3449938.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>
>

Re: Solr main query response & input to facet query

Posted by Erik Hatcher <er...@gmail.com>.
I'm not following exactly what you're looking for here, but sounds like you want to facet on name... &facet=on&facet.field=name1

and then to filter on a selected one, you can use fq=name:name1

	Erik

On Oct 24, 2011, at 20:18 , solrdude wrote:

> Hi,
> I am implementing an solr solution where I want to use some field values
> from main query output as an input in building facet. How do I do that?
> 
> Eg: 
> Response from main query:
> 
> <doc>
> <str name="name">name1</str>
> <int name="prod_id">200</int>
> </doc>
> <doc>
> <str name="name">name1</str>
> <int name="prod_id">400</int>
> </doc>
> 
> I want to build facet for the query where "prod_id:200 prod_id:400". I like
> to do all this in single query ideally. if it can't be done in one query, I
> am ok with 2 query as well. Please help.
> 
> Thanks
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-main-query-response-input-to-facet-query-tp3449938p3449938.html
> Sent from the Solr - User mailing list archive at Nabble.com.