One method to generate any arbitrary query is to create your own QParser. In this case, because it's just two dismax queries, there is an easier way that I snuck in during QParser work: embedded queries.
The "standard" solr query syntax (which is a slightly modified lucene query syntax) supports an embedded query via the _query_ magic field name. _query_:"+foo +bar" is equivalent to +foo +bar. So a way to embed a dismax query in a standard lucene query is: _query_:"<!dismax>kittens" Another way to write that is _query_:"<!dismax v=kittens>" And yet another way (moving the query to a separate q1 parameter) is _query_:"<!dismax v=$q1>" & q1=kittens We can specify or override other dismax params in the local params: _query_:"<!dismax mm=100% qf='raw^r name^1' v=$q1>" & q1=kittens Here is an example of two different dismax queries with different weights on the example schema: http://localhost:8983/solr/select?q=_query_:";<!dismax qf=features v=$q1>"^0.5 _query_:"<!dismax qf='name^4 features' v=$q2>"^0.8&q1=solr&q2=ipod -Yonik On Mon, Feb 25, 2008 at 2:25 PM, Brian Whitman <[EMAIL PROTECTED]> wrote: > > > > Perhaps back up and see if we can do this a simpler way than a request > > handler... > > What is the query structure you are trying to generate? > > > > I have two dismax queries defined in a solrconfig. Something like > > <requestHandler name="q1" class="solr.DisMaxRequestHandler" > > ... > <str name="qf"> > raw^4 name^1 > </str> > </requestHandler> > > <requestHandler name="q2" class="solr.DisMaxRequestHandler" > > ... > <str name="qf"> > tags^3 type^2 > </str> > </requestHandler> > > They work fine on their own, and we often use &bf=sortable^... to > change the ordering. But we want to merge them. Result IDs that show > up in both need to go higher and with a url param we need to weight > between the two. So I am making a /combined requesthandler that takes > the query, the weights between the two and the value of the > bf=sortable boost. > > My handler: /combined?q=kittens&q1=0.5&q2=0.8&bfboost=2.0 > > Would query ?qt=q1&q=kittens&bf=2&fl=id, then ? > qt=q2&q=kittens&bf=2&fl=id. The request handler would return the > results of a term query with the (q1 returned IDs)^0.5 (q2 returned > IDs)^0.8. > > > > > > >