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 Roman Chyla <ro...@gmail.com> on 2011/03/02 16:24:08 UTC

multiple localParams for each query clause

Hi,

Is it possible to set local arguments for each query clause?

example:

{!type=x q.field=z}something AND {!type=database}something


I am pulling together result sets coming from two sources, Solr index
and DB engine - however I realized that local parameters apply only to
the whole query - so I don't know how to set the query to mark the
second clause as db-searchable.

Thanks,

  Roman

Re: multiple localParams for each query clause

Posted by Roman Chyla <ro...@gmail.com>.
Thanks Jonathan, this will be useful -- in the meantime, I have
implemented the query rewriting, using the QueryParsing.toString()
utility as an example.

On Wed, Mar 2, 2011 at 5:40 PM, Jonathan Rochkind <ro...@jhu.edu> wrote:
> Not per clause, no. But you can use the "nested queries" feature to set
> local params for each nested query instead.  Which is in fact one of the
> most common use cases for local params.
>
> &q=_query_:"{type=x q.field=z}something" AND
> _query_:"{!type=database}something"
>
> URL encode that whole thing though.
>
> http://www.lucidimagination.com/blog/2009/03/31/nested-queries-in-solr/
>
> On 3/2/2011 10:24 AM, Roman Chyla wrote:
>>
>> Hi,
>>
>> Is it possible to set local arguments for each query clause?
>>
>> example:
>>
>> {!type=x q.field=z}something AND {!type=database}something
>>
>>
>> I am pulling together result sets coming from two sources, Solr index
>> and DB engine - however I realized that local parameters apply only to
>> the whole query - so I don't know how to set the query to mark the
>> second clause as db-searchable.
>>
>> Thanks,
>>
>>   Roman
>

Re: multiple localParams for each query clause

Posted by Jonathan Rochkind <ro...@jhu.edu>.
Not per clause, no. But you can use the "nested queries" feature to set 
local params for each nested query instead.  Which is in fact one of the 
most common use cases for local params.

&q=_query_:"{type=x q.field=z}something" AND 
_query_:"{!type=database}something"

URL encode that whole thing though.

http://www.lucidimagination.com/blog/2009/03/31/nested-queries-in-solr/

On 3/2/2011 10:24 AM, Roman Chyla wrote:
> Hi,
>
> Is it possible to set local arguments for each query clause?
>
> example:
>
> {!type=x q.field=z}something AND {!type=database}something
>
>
> I am pulling together result sets coming from two sources, Solr index
> and DB engine - however I realized that local parameters apply only to
> the whole query - so I don't know how to set the query to mark the
> second clause as db-searchable.
>
> Thanks,
>
>    Roman