I am using SolrNet for site search. However, now I need to show some documents at the top for specific queries. I went through the Query Elevation manual http://wiki.apache.org/solr/QueryElevationComponent and set up solrconfig.xml accordingly. The the debugging url mentioned in the manual is working pretty well.
I just don't know how to use Query elevation component with Solrnet. I cannot find any code example in SolrNet wiki that shows how to use elevate.xml. Any example, suggestion will be highly appreciated.
Based on the QueryElevatorComponent documentation on the wiki, you have a few options for enabling this for use with the SolrNet client.
You can add the following parameter to your SolrNet client query, to tell Solr to use the elevate RequestHandler instead of the default.
solr.Query("ipod", new QueryOptions {
ExtraParams = new Dictionary<string, string> {
{"qt", "elevate"}
}
});
Modify your default request handler in the solrconfig.xml file to add the elevate component as last-component. Below is a modified version of solrconfig.xml that comes with the Solr distribution sample file. Note: This assumes that you have the elevator searchcComponent defined as shown in the wiki page.
<requestHandler name="search" class="solr.SearchHandler" default="true">
<!-- default values for query parameters can be specified, these
will be overridden by parameters in the request
-->
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
</lst>
...
<arr name="last-components">
<str>elevator</str>
</arr>
</requestHandler>