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 Yanis Kakamaikis <ya...@gmail.com> on 2013/06/16 08:01:26 UTC

New operator.

Hi all,    I want to add a new operator to my solr.   I need that operator
to call my proprietary engine and build an answer vector to solr, in a way
that this vector will be part of the boolean query at the next step.   How
do I do that?
Thanks

Re: New operator.

Posted by Yanis Kakamaikis <ya...@gmail.com>.
Thanks, Roman.  I'm going to do some digging...


On Mon, Jun 17, 2013 at 9:53 PM, Roman Chyla <ro...@gmail.com> wrote:

> Hello Yanis,
>
> We are probably using something similar - eg. 'functional operators' - eg.
> edismax() to treat everything inside the bracket as an argument for
> edismax, or pos() to search for authors based on their position. And
> invenio() which is exactly what you describe, to get results from external
> engine. Depending on the level of complexity, you may need any/all of the
> following
>
> 1. query parser that understands the operator syntax and can build some
> 'external search' query object
> 2. the 'query object' that knows to contact the external service and return
> lucene docids - so you will need some translation
> externalIds<->luceneDocIds - you can for example index the same primary key
> in both solr and the ext engine, and then use a cache for the mapping
>
> To solve the 1, you could use the
> https://issues.apache.org/jira/browse/LUCENE-5014 - sorry for the
> shameless
> plug :) - but this is what we use and what i am familiar with, you can see
> a grammar that gives you the 'functional operator' here - if you dig
> deeper, you will see how it is building different query objects for
> different operators:
>
> https://github.com/romanchyla/montysolr/blob/master/contrib/adsabs/grammars/ADS.g
>
> and here an example how to ask the external engine for results and return
> lucene docids:
>
> https://github.com/romanchyla/montysolr/blob/master/contrib/invenio/src/java/org/apache/lucene/search/InvenioWeight.java
>
> it is a bit messy and you should probably ignore how we are getting the
> results, just look at nextDoc()
>
> HTH,
>
>   roman
>
>
> On Mon, Jun 17, 2013 at 2:34 PM, Yanis Kakamaikis <
> yanis.kakamaikis@gmail.com> wrote:
>
> > Hi all,   thanks for your reply.
> > I want to be able to ask a combined query,  a normal solr querym but one
> of
> > the query fields should get it's answer not from within the solr engine,
> > but from an external engine.
> > the rest should work normaly with the ability to do more tasks on the
> > answer like faceting for example.
> > The external engine will use the same objects ids like solr, so the
> boolean
> > query that uses this engine answer be executed correctly.
> > For example, let say I want to find a person by his name, age, address,
> and
> > also by his picture. I have a picture indexing engine, I want to create a
> > combined query that will call this engine like other query field.   I
> hope
> > it's more clear now...
> >
> >
> > On Sun, Jun 16, 2013 at 4:02 PM, Jack Krupansky <jack@basetechnology.com
> > >wrote:
> >
> > > It all depends on what you mean by an "operator".
> > >
> > > Start by describing in more detail what problem you are trying to
> solve.
> > >
> > > And how do you expect your users or applications to use this
> "operator".
> > > Give some examples.
> > >
> > > Solr and Lucene do not have "operators" per say, except in query parser
> > > syntax, but that is hard-wired into the individual query parsers.
> > >
> > > -- Jack Krupansky
> > >
> > > -----Original Message----- From: Yanis Kakamaikis
> > > Sent: Sunday, June 16, 2013 2:01 AM
> > > To: solr-user@lucene.apache.org
> > > Subject: New operator.
> > >
> > >
> > > Hi all,    I want to add a new operator to my solr.   I need that
> > operator
> > > to call my proprietary engine and build an answer vector to solr, in a
> > way
> > > that this vector will be part of the boolean query at the next step.
> > How
> > > do I do that?
> > > Thanks
> > >
> >
>

Re: New operator.

Posted by Roman Chyla <ro...@gmail.com>.
Hello Yanis,

We are probably using something similar - eg. 'functional operators' - eg.
edismax() to treat everything inside the bracket as an argument for
edismax, or pos() to search for authors based on their position. And
invenio() which is exactly what you describe, to get results from external
engine. Depending on the level of complexity, you may need any/all of the
following

1. query parser that understands the operator syntax and can build some
'external search' query object
2. the 'query object' that knows to contact the external service and return
lucene docids - so you will need some translation
externalIds<->luceneDocIds - you can for example index the same primary key
in both solr and the ext engine, and then use a cache for the mapping

To solve the 1, you could use the
https://issues.apache.org/jira/browse/LUCENE-5014 - sorry for the shameless
plug :) - but this is what we use and what i am familiar with, you can see
a grammar that gives you the 'functional operator' here - if you dig
deeper, you will see how it is building different query objects for
different operators:
https://github.com/romanchyla/montysolr/blob/master/contrib/adsabs/grammars/ADS.g

and here an example how to ask the external engine for results and return
lucene docids:
https://github.com/romanchyla/montysolr/blob/master/contrib/invenio/src/java/org/apache/lucene/search/InvenioWeight.java

it is a bit messy and you should probably ignore how we are getting the
results, just look at nextDoc()

HTH,

  roman


On Mon, Jun 17, 2013 at 2:34 PM, Yanis Kakamaikis <
yanis.kakamaikis@gmail.com> wrote:

> Hi all,   thanks for your reply.
> I want to be able to ask a combined query,  a normal solr querym but one of
> the query fields should get it's answer not from within the solr engine,
> but from an external engine.
> the rest should work normaly with the ability to do more tasks on the
> answer like faceting for example.
> The external engine will use the same objects ids like solr, so the boolean
> query that uses this engine answer be executed correctly.
> For example, let say I want to find a person by his name, age, address, and
> also by his picture. I have a picture indexing engine, I want to create a
> combined query that will call this engine like other query field.   I hope
> it's more clear now...
>
>
> On Sun, Jun 16, 2013 at 4:02 PM, Jack Krupansky <jack@basetechnology.com
> >wrote:
>
> > It all depends on what you mean by an "operator".
> >
> > Start by describing in more detail what problem you are trying to solve.
> >
> > And how do you expect your users or applications to use this "operator".
> > Give some examples.
> >
> > Solr and Lucene do not have "operators" per say, except in query parser
> > syntax, but that is hard-wired into the individual query parsers.
> >
> > -- Jack Krupansky
> >
> > -----Original Message----- From: Yanis Kakamaikis
> > Sent: Sunday, June 16, 2013 2:01 AM
> > To: solr-user@lucene.apache.org
> > Subject: New operator.
> >
> >
> > Hi all,    I want to add a new operator to my solr.   I need that
> operator
> > to call my proprietary engine and build an answer vector to solr, in a
> way
> > that this vector will be part of the boolean query at the next step.
> How
> > do I do that?
> > Thanks
> >
>

Re: New operator.

Posted by Yanis Kakamaikis <ya...@gmail.com>.
Hi all,   thanks for your reply.
I want to be able to ask a combined query,  a normal solr querym but one of
the query fields should get it's answer not from within the solr engine,
but from an external engine.
the rest should work normaly with the ability to do more tasks on the
answer like faceting for example.
The external engine will use the same objects ids like solr, so the boolean
query that uses this engine answer be executed correctly.
For example, let say I want to find a person by his name, age, address, and
also by his picture. I have a picture indexing engine, I want to create a
combined query that will call this engine like other query field.   I hope
it's more clear now...


On Sun, Jun 16, 2013 at 4:02 PM, Jack Krupansky <ja...@basetechnology.com>wrote:

> It all depends on what you mean by an "operator".
>
> Start by describing in more detail what problem you are trying to solve.
>
> And how do you expect your users or applications to use this "operator".
> Give some examples.
>
> Solr and Lucene do not have "operators" per say, except in query parser
> syntax, but that is hard-wired into the individual query parsers.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Yanis Kakamaikis
> Sent: Sunday, June 16, 2013 2:01 AM
> To: solr-user@lucene.apache.org
> Subject: New operator.
>
>
> Hi all,    I want to add a new operator to my solr.   I need that operator
> to call my proprietary engine and build an answer vector to solr, in a way
> that this vector will be part of the boolean query at the next step.   How
> do I do that?
> Thanks
>

Re: New operator.

Posted by Jack Krupansky <ja...@basetechnology.com>.
It all depends on what you mean by an "operator".

Start by describing in more detail what problem you are trying to solve.

And how do you expect your users or applications to use this "operator". 
Give some examples.

Solr and Lucene do not have "operators" per say, except in query parser 
syntax, but that is hard-wired into the individual query parsers.

-- Jack Krupansky

-----Original Message----- 
From: Yanis Kakamaikis
Sent: Sunday, June 16, 2013 2:01 AM
To: solr-user@lucene.apache.org
Subject: New operator.

Hi all,    I want to add a new operator to my solr.   I need that operator
to call my proprietary engine and build an answer vector to solr, in a way
that this vector will be part of the boolean query at the next step.   How
do I do that?
Thanks 


Re: New operator.

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Hello Yanis,

Two options.
1. Create own SearchComponent, which adds filterQuery into request, and add
it into SearchHandler. http://wiki.apache.org/solr/SearchComponent
2. Create QParserPlugin and call them by request param
...&fq={!yanisqp}applyvector&...
http://wiki.apache.org/solr/SolrPlugins#QParserPlugin


On Sun, Jun 16, 2013 at 10:01 AM, Yanis Kakamaikis <
yanis.kakamaikis@gmail.com> wrote:

> Hi all,    I want to add a new operator to my solr.   I need that operator
> to call my proprietary engine and build an answer vector to solr, in a way
> that this vector will be part of the boolean query at the next step.   How
> do I do that?
> Thanks
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
 <mk...@griddynamics.com>