Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change 
notification.

The following page has been changed by ryan:
http://wiki.apache.org/solr/QueryElevationComponent

New page:
/!\ This refers to content that requires 
[https://issues.apache.org/jira/browse/SOLR-418 SOLR-418] to be installed

The !QueryElevationComponent enables you to configure the top results for a 
given query regardless of the normal lucene scoring.  This component matches 
the user query text to a configured Map of top results.  Although this 
component will work with any QueryParser, it makes the most sense to use with 
DisMax style queries.


[[TableOfContents]]

= Configuration =

== solrconfig.xml ==

The query elevation component is configured in solrconfig.xml.  A typical 
configuration may look like:
{{{
  <searchComponent name="elevate" 
class="org.apache.solr.handler.component.QueryElevationComponent" >
    <str name="analyzer">string</str>
    <str name="config-file">elevate.xml</str>
  </searchComponent>

  <requestHandler name="/elevate" class="solr.SearchHandler">
    <lst name="defaults">
      <str name="echoParams">explicit</str>
    </lst>
    <arr name="last-components">
      <str>elevate</str>
    </arr>
  </requestHandler>
}}}

Available arguments to for the searchComponent are:

=== analyzer ===
configure which fieldType should be used to analyze the incoming text.  It may 
be appropriate to use a fieldType with a LowerCaseFilter.

=== config-file ===
Path to the file that defines query elevation.  This file must exist in:
 1. ${instanceDir}/conf/${config-file}
or
 2. ${dataDir}/${config-file}

If the file exists in the /conf/ directory it will be loaded once at starup.  
If it exists within the data directory, it will be reloaded for each 
IndexReader.

=== forceElevation ===
By default, this component respects the requested 'sort' parameter -- that is, 
if the request asks to sort by date, it will order the results by date.  If 
forceElevation=true, results will first return the boosted docs, then order by 
date.


== elevate.xml ==

Elevated query results are configured in an external .xml file determined by 
the ''config-file'' argument.  An elevate.xml file may look like this:

{{{
<elevate>

 <query text="AAA">
  <doc id="A" />
  <doc id="B" />
 </query>

 <query text="ipod">
  <doc id="A" />

  <!-- you can optionally exclude documents from a query result -->
  <doc id="B" exclude="true" />
 </query>

</elevate>
}}}

For the above configuration, the query "AAA" would first return document A,B, 
then whatever normally appears for the same query.  For the query "ipod", it 
would first return A, and would make sure that B is not in the result set.

= Usage =

All standard solr features such as faceting,sorting, and !MoreLikeThis work 
with this component installed.

Reply via email to