You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ahson Iqbal <mi...@yahoo.com> on 2011/01/27 09:27:55 UTC
Question About Writing Custom Query Parser Plugin
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
Re: Question About Writing Custom Query Parser Plugin
Posted by Erik Hatcher <er...@gmail.com>.
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
>
>
Re: Question About Writing Custom Query Parser Plugin
Posted by rahul23134 <ra...@gmail.com>.
Can any one suggest me how to write this class ?
--
View this message in context: http://lucene.472066.n3.nabble.com/Question-About-Writing-Custom-Query-Parser-Plugin-tp2360751p3527095.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Question About Writing Custom Query Parser Plugin
Posted by rahul23134 <ra...@gmail.com>.
Have you made that class i want to integrate the surround plugin with solr .
--
View this message in context: http://lucene.472066.n3.nabble.com/Question-About-Writing-Custom-Query-Parser-Plugin-tp2360751p3527092.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Question About Writing Custom Query Parser Plugin
Posted by Ahsan |qbal <ah...@gmail.com>.
Any One
On Thu, Jan 27, 2011 at 1:27 PM, Ahson Iqbal <mi...@yahoo.com> 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
>
>
>