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 Kranti <kr...@gmail.com> on 2014/01/08 02:20:38 UTC

Re: how to best convert some term in q to a fq

As Joel suggested it would be easy to find that outside of solr. But if you really want to do the solr way, then you would need to write custom request handler or query component. The later needs more understanding of solr/lucene APIs. The former would be relatively simple to set the fq into solr params exists in solr query request.



> On Dec 23, 2013, at 3:07 PM, Joel Bernstein <jo...@gmail.com> wrote:
> 
> I  would suggest handling this in the client. You could write custom Solr
> code also but it would be more complicated because you'd be working with
> Solr's API's.
> 
> Joel Bernstein
> Search Engineer at Heliosearch
> 
> 
>> On Mon, Dec 23, 2013 at 2:36 PM, jmlucjav <jm...@gmail.com> wrote:
>> 
>> Hi,
>> 
>> I have this scenario that I think is no unusual: solr will get a user
>> entered query string like 'apple pear france'.
>> 
>> I need to do this: if any of the terms is a country, then change the query
>> params to move that term to a fq, i.e:
>> q=apple pear france
>> to
>> q=apple pear&fq=country:france
>> 
>> What do you guys would be the best way to implement this?
>> - custom searchcomponent or queryparser
>> - servlet in same jetty as solr
>> - client code
>> 
>> To simplify, consider countries are just a single term.
>> 
>> Any pointer to an example to base this on would be great. thanks
>>