Search code examples
solrlucenesearch-engine

Integrating Surround Query Parser


I want to Run surround query .

  1. Downloading from http://www.java2s.com/Code/Jar/JKL/Downloadlucenesurround241jar.htm

  2. Moved the lucene-surround-2.4.1.jar to /apache-solr-3.1.0/example/lib

  3. Edit the solrconfig.xml with <queryParser name="SurroundQParser" class="org.apache.lucene.queryParser.surround.parser.QueryParser"/>

  4. Restart Solr

Got this error :

org.apache.solr.common.SolrException: Error Instantiating QParserPlugin, org.apache.lucene.queryParser.surround.parser.QueryParser is not a org.apache.solr.search.QParserPlugin at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:425)


Solution

    1. Never get JARs from java2s.com, it's just a website with code samples, not the official source of any JARs. In this case, the surround query parser is part of Lucene contrib, which is included in the official Lucene distribution.
    2. Support for the surround parser in Solr was only recently added: you'll have to get a recent nightly build for Solr 4.0.
    3. See the patch for an example of installing the surround query parser.