-
Notifications
You must be signed in to change notification settings - Fork 4
Get me up and running
Get the jar file in one of the following ways:
<repositories>
<repository>
<id>solr-quantities-detection-qparsers-mvn-repo</id>
<url>https://raw.github.com/SeaseLtd/solr-quantities-detection-qparsers/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
...
<dependency>
<groupId>io.sease</groupId>
<artifactId>solr-quantities-detection-qparsers</artifactId>
<version>1.0</version>
</dependency>Assuming you already have Java 8 and Apache Maven (3.x) in your environment, just clone this repository and then run
$ mvn clean install
At the end the artifact solr-quantities-detection-qparsers-1.0.jar will be built under the target folder
The module configuration is detailed here, you can grab some additional example under the test/resources directory [1] of the project.
Once created, the file units.json must be put under the core conf directory.
The configuration, within the solrconfig.xml, in places.
You have several alternatives here:
- put the plugin library under the lib folder
- use the <lib directive in solrconfig.xml
If you are on the development machine and you downloaded the library as a Maven dependency, you can put this line in the solrconfig.xml:
<lib dir="${user.home}/.m2/repository/io/sease/labs/solr-quantities-detection-qparsers/1.0/" regex=".*\.jar" />It will grab the dependency in your local repository.
The repository contains three plugins:
<queryParser name="qty" class="io.sease.labs.solr.qty.QuantityDetectionQParserPlugin"/>
<queryParser name="bqty" class="io.sease.labs.solr.qty.QuantityDetectionBQParserPlugin"/>
<queryParser name="bfqty" class="io.sease.labs.solr.qty.QuantityDetectionBFParserPlugin"/> In the example above:
- qty is the name of the QParserPlugin which produces the parser for analysing the main query (q)
- bqty is the name of the QParserPlugin which produces the parser for analysing boost queries (bq)
- bfqty is the name of the QParserPlugin which produces the parser for analyzing boost functions (bf)
you use a different name for them, of course. But if you do that, remember that those names will be used in the subsequent configuration section.
The following is just an example: the actual configuration depends on your context. Note the QParserPlugin identifiers defined in the previous section must be the same.
<requestHandler name="/search" class="solr.SearchHandler" default="true">
<lst name="invariants">
<str name="defType">qty</str>
</lst>
<lst name="defaults">
<str name="qf">
product_name
brand
</str>
<str name="bq">{!bqty v=$q}</str>
<str name="boost">{!bfqty v=$q}</str>
</lst>
</requestHandler>And that should be all what you need. Enjoy!
[1] https://github.com/SeaseLtd/solr-quantities-detection-qparsers/tree/master/src/test/resources