You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2010/06/30 23:08:23 UTC
[Solr Wiki] Update of "QueryElevationComponent" by GrantIngersoll
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The "QueryElevationComponent" page has been changed by GrantIngersoll.
http://wiki.apache.org/solr/QueryElevationComponent?action=diff&rev1=13&rev2=14
--------------------------------------------------
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:
- == solrconfig.xml ==
-
- The query elevation component is configured in solrconfig.xml. A typical configuration may look like:
{{{
<searchComponent name="elevator" class="org.apache.solr.handler.component.QueryElevationComponent" >
<str name="queryFieldType">string</str>
@@ -25, +23 @@
</arr>
</requestHandler>
}}}
-
Available arguments for the searchComponent are:
=== queryFieldType ===
@@ -33, +30 @@
=== 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}
+ 1. ${dataDir}/${config-file}
If the file exists in the /conf/ directory it will be loaded once at start-up. If it exists in 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:
{{{
@@ -63, +59 @@
</elevate>
}}}
-
For the above configuration, the query "AAA" would first return documents A and 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.
Note: The uniqueKey field must currently be of type string for the QueryElevationComponent to operate properly.
= Usage =
-
All standard solr features such as faceting, sorting, and !MoreLikeThis work with this component installed.
== enableElevation ==
For debugging it may be useful to see results with and without the elevated docs. To hide results use "enableElevation=false", like this:
+
- http://localhost:8983/solr/elevate?q=YYYY&debugQuery=true&enableElevation=true
+ . http://localhost:8983/solr/elevate?q=YYYY&debugQuery=true&enableElevation=true
-
http://localhost:8983/solr/elevate?q=YYYY&debugQuery=true&enableElevation=false
== forceElevation ==
Elevation can also be forced during runtime by adding forceElevation=true to the query URL:
+
- http://localhost:8983/solr/elevate?q=YYYY&debugQuery=true&enableElevation=true&forceElevation=true
+ . http://localhost:8983/solr/elevate?q=YYYY&debugQuery=true&enableElevation=true&forceElevation=true
+
+ == exclusive ==
+ Solr 3.x, Solr 4.0: https://issues.apache.org/jira/browse/SOLR-1966
+
+ If you want to return '''''only''''' the results specified in the elevation file, add exclusive=true to the URL:
+
+ [[http://localhost:8983/solr/elevate?q=YYYY&debugQuery=true&enableElevation=true&forceElevation=true|http://localhost:8983/solr/elevate?q=YYYY&debugQuery=true&exclusive=true]]
== fq ==
Query elevation respects the standard "filter query" (fq) parameter. That is, if the query contains a fq parameter, all results will be within that filter even if elevate.xml adds other documents to the result set.