Of course I saw my error within seconds of pressing send. The
"invariants" block should appear outside the "defaults" block in the
RequestHandler.
On 08/31/2012 04:25 PM, Carrie Coy wrote:
(solr4-beta) I'm trying to follow the instructions in this article:
http://searchhub.org/dev/2011/06/20/solr-powered-isfdb-part-10/ to
apply a custom sort order to search results:
Essentially, it involves creating a new qq parameter, and substituting
it into the original q parameter as a local param via an invariant, as
below.
My RequestHandler looks like this:
<requestHandler name="/browse" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">all</str>
<!-- VelocityResponseWriter settings -->
<lst name="invariants">
<str name="q">{!boost b=page_views v=$qq}</str>
</lst>
<str name="wt">velocity</str>
<str name="v.template">browse</str>
<str name="v.layout">layout</str>
<str name="qq">*:*</str>
....
</requestHandler>
I triple-checked the small modifications these files:
velocity/VM_global_library.vm.
#macro(q)&qq=$!{esc.url($params.get('qq'))}#end
velocity/query.vm
<span #annTitle("Add the query using the &qq= parameter")>Find: <input
type="text" id="q" name="qq" value="$!esc.html($params.get('qq'))"/>
<input type="submit" id="querySubmit"/> <input type="reset"/></span>
But instead of creating a query like this:
http://localhost:8080/solr/ssww/browse?q={!boost b=page_views
v=$qq}&qq=glue (which returns great results)
It creates this:
http://localhost:8080/solr/ssww/browse?qq=glue (no results)
From the query debugging:
<lstname="params">
<strname="qq">glue</str>
<strname="v.template">browse</str>
<strname="qf">title^2 description^0.5 cat^0.5 bullets^0.5
search_keywords^0.3 </str>
<strname="wt">xml</str>
<strname="rows">10</str>
<strname="defType">edismax</str>
<strname="invariants">{q={!boost b=page_views v=$qq}}</str>
<strname="debug">true</str>
<strname="wt">xml</str>
<strname="qq">glue</str>
<lstname="debug">
<nullname="rawquerystring"></null>
<nullname="querystring"></null>
<strname="parsedquery"></str>
<strname="parsedquery_toString"></str>
<lstname="explain"></lst>
<strname="QParser">ExtendedDismaxQParser</str>
<nullname="altquerystring"></null>
<nullname="boostfuncs"></null>
Does anybody know what I might have done wrong?