Difference between revisions of "Solr Query Parser Plug-In"
For Information on Aspire 3.1 Click Here
(→Special "boost" parameter)
m (Protected "Solr Query Parser Plug-In" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
Revision as of 17:07, 3 March 2017
To use QPL for Solr, you will need to install a Solr Query Parser Plug-In into Solr.
Supported Solr Versions
The QPL plugin for Solr is currently available for the following versions:
|Solr Version||QPL version||Plugin jar file|
|4.4.0 and CDH 5.1||0.2
NOTE: Versions 0.1 & 0.2 are compiled using Java 6. From version 0.3-SNAPSHOT onwards, Java 7 is used
Install the Plug-In
Instructions on downloading QPL can be found here.
To install the plug-in in a single core Solr (see note about multi-core), do the following:
- Create a "lib" directory (if it doesn't already exist) inside your "solr" directory.
- This should be at the same level as the Solr "conf" directory
- Copy the following three jar files into your new lib directory:
- Groovy All: groovy-all-2.0.4.jar
- QPL Solr Plug-In: qpl-solr-0.1-SNAPSHOT.jar
- The QPL Engine: query-processing-language-0.1-SNAPSHOT.jar
- For a multi-core implementation you need to deploy the files to the application server instead. For example, in the embedded Jetty app server, you should put them at <SolrDeployPath>/example/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/ (of course the path may vary if the port to use or the application server are different
- for the "default" example collection1 in Solr 472, the jar files should be installed to solr-4.7.2/example/solr-webapp/webapp/WEB-INF/lib
- Your plug-ins and jar files may have different version numbers than those in this article
Configure the Plug-In
To configure the plug-in, add the following to your solrconfig.xml:
<queryParser name="qpl" class="com.searchtechnologies.qpl.solr.QPLSolrQParserPlugin"> <str name="scriptFile">test.qpl</str> <str name="defaultField">text</str> </queryParser>
Add the libraries path to solrconfig.xml when necessary. In this case the lib file is located in the collection's conf directory:
<lib dir="conf/lib" regex=".*\.jar" />
The two configuration parameters are:
- scriptFile - The name of your QPL script file which will be used to process queries.
- If this is a relative path, then it will be automatically assumed to be relative to the Solr config directory (i.e. "solr/conf")
- defaultField - The default field used for terms for which no field is specified.
- Note: This is only used if the default field is NOT specified in Solr using the "df" parameter.
Using the Plug-In
To use the plug-in, add "defType=qpl" to your Solr query URL. For example:
Special "boost" parameter
Now query functions can be specified with a "boost" parameter. The boost parameter works the same as the EDISMAX parser boost parameter.
The following multiplies the final query score by 0.1.
Multiple boost parameters can be included. All of their values are multiplied by the final score, and the result is the final query score.
(Solr 5.3 version and later only)