Yes, you need to create both a QParserPlugin and a QParser implementation.  
Look at Solr's own source code for the LuceneQParserPlugin/LuceneQParser and 
built it like that.

Baking the surround query parser into Solr out of the box would be a useful 
contribution, so if you care to give it a little bit of polish/unit testing and 
submit a patch, the community would be thankful :)

        Erik

On Jan 27, 2011, at 03:27 , Ahson Iqbal wrote:

> Hi All
> 
> I want to integrate lucene Surround Query Parser with solr 1.4.1, and for 
> that I 
> am writing Custom Query Parser Plugin, To accomplish this task I should write 
> a 
> sub class of "org.apache.solr.search.QParserPlugin" and implement its two 
> methods 
> 
> public void init(NamedList nl)
> public QParser createParser(String string, SolrParams sp, SolrParams sp1, 
> SolrQueryRequest sqr)
> 
> now here createParser should return an object of a subclass of 
> "org.apache.solr.search.QParser", but I need a parser of type 
> "org.apache.lucene.queryParser.surround.parser.QueryParser" which is not a 
> subclass of "org.apache.solr.search.QParser"
> 
> Now my question is should I write a sub class 
> of "org.apache.solr.search.QParser" and internally create an object 
> of "org.apache.lucene.queryParser.surround.parser.QueryParser" and call its 
> parse method? if so how the mapping 
> "org.apache.lucene.queryParser.surround.query.SrndQuery" (that is 
> returned "org.apache.lucene.queryParser.surround.parser.QueryParser" ) would 
> be 
> done with "org.apache.lucene.search.Query" (that should be returned from 
> parse 
> method of a query parser of type "org.apache.solr.search.QParser")
> 
> Thanx 
> Ahsan
> 
> 

Reply via email to