views:

150

answers:

1

I have created a request handler in Solr that uses dismax and limits my query to certain fields and adds boosts for relevancy on the "title" field.

This all works fine when I go directly to Solr using an http request in a browser. However my question is whether I can use the request handler if I am accessing Solr using SolrJ?

It would be better if I could control boosts and filters and so on in the request handler rather than having to make code changes but I can't see how to specify a request handler in the API.

Any ideas?

A: 

In the class SolrQuery, there is a method setQueryType that allows you to do that. You pass the name of the request handler as defined in solrconfig.xml (probably 'dismax').

Pascal Dimassimo
Thanks! That works.
Pinguthepenguin