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 gdeconto <ge...@topproducer.com> on 2009/09/04 22:45:48 UTC

how to create a custom queryparse to handle new functions

Can someone point me in the general direction of how to create a custom
queryparser that would allow me to create custom query commands like this:

http://localhost:8994/solr/select?q=myfunction(‘Foo’, 3)

or point me towards an example?

note that the actual functionality of myfunction is not defined.  I am just
wondering if this sort of extensibility is possible.
-- 
View this message in context: http://www.nabble.com/how-to-create-a-custom-queryparse-to-handle-new-functions-tp25301698p25301698.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: how to create a custom queryparse to handle new functions

Posted by Chris Hostetter <ho...@fucit.org>.
I think you and Shalin are having a vocabulary problem.

you used the term "function" which has a specific meaning in Solr, if you 
want to write a new function, which works with the existing Function 
syntax solr provides, and can be nested inside of other functions, then 
what you want to write is a ValueSourceParser.  If you want to write your 
own Query parser with an entirely new syntax (in which you want things to 
look like function calls and produce query objects) then you need to 
implement a QParserPlugin.

Some pointers about both can be found here...

	http://wiki.apache.org/solr/SolrPlugins

: > You do not need to create a custom query parser for this. You just need to
: > create a custom function query. Look at one of the existing function queries
: > in Solr as an example.
: >
: This is where the need originates from -
: http://www.lucidimagination.com/search/document/a4bb0dfee53f7493/how_to_scan_dynamic_field_without_specifying_each_field_in_query
: 
: Within the function, the intent is to rewrite incoming parameter into a
: different query. Can this be done? AFAIK, not.
: 
: Cheers
: Avlesh
: 
: On Sat, Sep 5, 2009 at 3:21 AM, Shalin Shekhar Mangar <
: shalinmangar@gmail.com> wrote:
: 
: > On Sat, Sep 5, 2009 at 2:15 AM, gdeconto <gerald.deconto@topproducer.com
: > >wrote:
: >
: > >
: > > Can someone point me in the general direction of how to create a custom
: > > queryparser that would allow me to create custom query commands like
: > this:
: > >
: > > http://localhost:8994/solr/select?q=myfunction(<http://localhost:8994/solr/select?q=myfunction%28>
: > <http://localhost:8994/solr/select?q=myfunction%28>�Foo�,
: > > 3)
: > >
: > > or point me towards an example?
: > >
: > > note that the actual functionality of myfunction is not defined.  I am
: > just
: > > wondering if this sort of extensibility is possible.
: > >
: >
: > You do not need to create a custom query parser for this. You just need to
: > create a custom function query. Look at one of the existing function
: > queries
: > in Solr as an example.
: >
: >
: > --
: > Regards,
: > Shalin Shekhar Mangar.
: >
: 



-Hoss

Re: how to create a custom queryparse to handle new functions

Posted by Avlesh Singh <av...@gmail.com>.
>
> You do not need to create a custom query parser for this. You just need to
> create a custom function query. Look at one of the existing function queries
> in Solr as an example.
>
This is where the need originates from -
http://www.lucidimagination.com/search/document/a4bb0dfee53f7493/how_to_scan_dynamic_field_without_specifying_each_field_in_query

Within the function, the intent is to rewrite incoming parameter into a
different query. Can this be done? AFAIK, not.

Cheers
Avlesh

On Sat, Sep 5, 2009 at 3:21 AM, Shalin Shekhar Mangar <
shalinmangar@gmail.com> wrote:

> On Sat, Sep 5, 2009 at 2:15 AM, gdeconto <gerald.deconto@topproducer.com
> >wrote:
>
> >
> > Can someone point me in the general direction of how to create a custom
> > queryparser that would allow me to create custom query commands like
> this:
> >
> > http://localhost:8994/solr/select?q=myfunction(<http://localhost:8994/solr/select?q=myfunction%28>
> <http://localhost:8994/solr/select?q=myfunction%28>‘Foo’,
> > 3)
> >
> > or point me towards an example?
> >
> > note that the actual functionality of myfunction is not defined.  I am
> just
> > wondering if this sort of extensibility is possible.
> >
>
> You do not need to create a custom query parser for this. You just need to
> create a custom function query. Look at one of the existing function
> queries
> in Solr as an example.
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: how to create a custom queryparse to handle new functions

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Sat, Sep 5, 2009 at 2:15 AM, gdeconto <ge...@topproducer.com>wrote:

>
> Can someone point me in the general direction of how to create a custom
> queryparser that would allow me to create custom query commands like this:
>
> http://localhost:8994/solr/select?q=myfunction(<http://localhost:8994/solr/select?q=myfunction%28>‘Foo’,
> 3)
>
> or point me towards an example?
>
> note that the actual functionality of myfunction is not defined.  I am just
> wondering if this sort of extensibility is possible.
>

You do not need to create a custom query parser for this. You just need to
create a custom function query. Look at one of the existing function queries
in Solr as an example.


-- 
Regards,
Shalin Shekhar Mangar.