You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ajinkya Kale <ka...@gmail.com> on 2015/09/18 04:44:35 UTC

Question related to reranking and RankQuery

Hi all,

I am new to Solr. I have a QParser plugin which uses an implementation
of CustomScoreQuery to provide custom score for each document.
Is there a way I can use the same plugin to provide score for top N
documents after an initial query/sort ?
I looked at the ReRankQParserPlugin but it looks lot more involved to write
a custom RankQuery implementation. So I was thinking if I can reuse my
existing CustomScoreQuery implementation to provide score for top N
documents to rerank.

On a side note, is there a place where the ReRankQParserPlugin is explained
in detail ?

--aj

Re: Question related to reranking and RankQuery

Posted by Ajinkya Kale <ka...@gmail.com>.
Thank Joel!
This is exactly what I was looking for. I did not realize rerank was
extensible to your own Function Query. This is good.

--aj

On Fri, Sep 18, 2015 at 12:00 PM Joel Bernstein <jo...@gmail.com> wrote:

> The syntax would be something like this:
>
> q=hello+world&rq={!rerank reRankQuery=$rqq
> reRankDocs=100}&rqq={!func}myFunc()
>
> I'm not sure if there is a test case demonstrating this but it should work.
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Fri, Sep 18, 2015 at 2:42 PM, Ajinkya Kale <ka...@gmail.com>
> wrote:
>
> > Is there a way I can issue a regular query with q and then apply
> > functionQuery only on the top n documents of the result from q ?
> > Applying functionQuery on all documents will be very expensive in my
> case.
> > I am not able to find a way to "rerank" only top N documents using
> Function
> > Query.
> >
> > --aj
> >
> > On Fri, Sep 18, 2015 at 5:04 AM Joel Bernstein <jo...@gmail.com>
> wrote:
> >
> > > The ReRankQuery re-ranks the Top N documents of the main query based
> on a
> > > query. Rather then the CustomScoreQuery you may want to look at
> ReRanking
> > > by a Function Query using the FunctionQParserPlugin. This would allow
> you
> > > to directly control the ReRankScore for the top N documents.
> > >
> > > Writing your own RankQuery should be the last resort if you can't make
> a
> > > Function Query do what you need to do.
> > >
> > >
> > >
> > > Joel Bernstein
> > > http://joelsolr.blogspot.com/
> > >
> > > On Thu, Sep 17, 2015 at 10:44 PM, Ajinkya Kale <ka...@gmail.com>
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > I am new to Solr. I have a QParser plugin which uses an
> implementation
> > > > of CustomScoreQuery to provide custom score for each document.
> > > > Is there a way I can use the same plugin to provide score for top N
> > > > documents after an initial query/sort ?
> > > > I looked at the ReRankQParserPlugin but it looks lot more involved to
> > > write
> > > > a custom RankQuery implementation. So I was thinking if I can reuse
> my
> > > > existing CustomScoreQuery implementation to provide score for top N
> > > > documents to rerank.
> > > >
> > > > On a side note, is there a place where the ReRankQParserPlugin is
> > > explained
> > > > in detail ?
> > > >
> > > > --aj
> > > >
> > >
> >
>

Re: Question related to reranking and RankQuery

Posted by Ajinkya Kale <ka...@gmail.com>.
Is there a way to do something like
q=hello+world&rq={!rerank reRankQuery=$rqq
reRankDocs=100}&rqq=sort={!func}myFunc() desc ?

or even as simple as


   1.
   http://localhost:8983/solr/0/select?q=edgengram:abc&wt=json&indent=true&debugQuery=true&rq={!rerank
   reRankQuery=$rqq reRankDocs=20}&rqq=sort=some_field desc

I am not able to get the last part right. I dont think my rqq is right.

--aj

On Fri, Sep 18, 2015 at 12:00 PM Joel Bernstein <jo...@gmail.com> wrote:

> The syntax would be something like this:
>
> q=hello+world&rq={!rerank reRankQuery=$rqq
> reRankDocs=100}&rqq={!func}myFunc()
>
> I'm not sure if there is a test case demonstrating this but it should work.
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Fri, Sep 18, 2015 at 2:42 PM, Ajinkya Kale <ka...@gmail.com>
> wrote:
>
> > Is there a way I can issue a regular query with q and then apply
> > functionQuery only on the top n documents of the result from q ?
> > Applying functionQuery on all documents will be very expensive in my
> case.
> > I am not able to find a way to "rerank" only top N documents using
> Function
> > Query.
> >
> > --aj
> >
> > On Fri, Sep 18, 2015 at 5:04 AM Joel Bernstein <jo...@gmail.com>
> wrote:
> >
> > > The ReRankQuery re-ranks the Top N documents of the main query based
> on a
> > > query. Rather then the CustomScoreQuery you may want to look at
> ReRanking
> > > by a Function Query using the FunctionQParserPlugin. This would allow
> you
> > > to directly control the ReRankScore for the top N documents.
> > >
> > > Writing your own RankQuery should be the last resort if you can't make
> a
> > > Function Query do what you need to do.
> > >
> > >
> > >
> > > Joel Bernstein
> > > http://joelsolr.blogspot.com/
> > >
> > > On Thu, Sep 17, 2015 at 10:44 PM, Ajinkya Kale <ka...@gmail.com>
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > I am new to Solr. I have a QParser plugin which uses an
> implementation
> > > > of CustomScoreQuery to provide custom score for each document.
> > > > Is there a way I can use the same plugin to provide score for top N
> > > > documents after an initial query/sort ?
> > > > I looked at the ReRankQParserPlugin but it looks lot more involved to
> > > write
> > > > a custom RankQuery implementation. So I was thinking if I can reuse
> my
> > > > existing CustomScoreQuery implementation to provide score for top N
> > > > documents to rerank.
> > > >
> > > > On a side note, is there a place where the ReRankQParserPlugin is
> > > explained
> > > > in detail ?
> > > >
> > > > --aj
> > > >
> > >
> >
>

Re: Question related to reranking and RankQuery

Posted by Ajinkya Kale <ka...@gmail.com>.
Thank Joel!
This is exactly what I was looking for. I did not realize rerank was
extensible to your own Function Query. This is good.

--aj

On Fri, Sep 18, 2015 at 12:00 PM Joel Bernstein <jo...@gmail.com> wrote:

> The syntax would be something like this:
>
> q=hello+world&rq={!rerank reRankQuery=$rqq
> reRankDocs=100}&rqq={!func}myFunc()
>
> I'm not sure if there is a test case demonstrating this but it should work.
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Fri, Sep 18, 2015 at 2:42 PM, Ajinkya Kale <ka...@gmail.com>
> wrote:
>
> > Is there a way I can issue a regular query with q and then apply
> > functionQuery only on the top n documents of the result from q ?
> > Applying functionQuery on all documents will be very expensive in my
> case.
> > I am not able to find a way to "rerank" only top N documents using
> Function
> > Query.
> >
> > --aj
> >
> > On Fri, Sep 18, 2015 at 5:04 AM Joel Bernstein <jo...@gmail.com>
> wrote:
> >
> > > The ReRankQuery re-ranks the Top N documents of the main query based
> on a
> > > query. Rather then the CustomScoreQuery you may want to look at
> ReRanking
> > > by a Function Query using the FunctionQParserPlugin. This would allow
> you
> > > to directly control the ReRankScore for the top N documents.
> > >
> > > Writing your own RankQuery should be the last resort if you can't make
> a
> > > Function Query do what you need to do.
> > >
> > >
> > >
> > > Joel Bernstein
> > > http://joelsolr.blogspot.com/
> > >
> > > On Thu, Sep 17, 2015 at 10:44 PM, Ajinkya Kale <ka...@gmail.com>
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > I am new to Solr. I have a QParser plugin which uses an
> implementation
> > > > of CustomScoreQuery to provide custom score for each document.
> > > > Is there a way I can use the same plugin to provide score for top N
> > > > documents after an initial query/sort ?
> > > > I looked at the ReRankQParserPlugin but it looks lot more involved to
> > > write
> > > > a custom RankQuery implementation. So I was thinking if I can reuse
> my
> > > > existing CustomScoreQuery implementation to provide score for top N
> > > > documents to rerank.
> > > >
> > > > On a side note, is there a place where the ReRankQParserPlugin is
> > > explained
> > > > in detail ?
> > > >
> > > > --aj
> > > >
> > >
> >
>

Re: Question related to reranking and RankQuery

Posted by Ajinkya Kale <ka...@gmail.com>.
Is there a way to do something like
q=hello+world&rq={!rerank reRankQuery=$rqq
reRankDocs=100}&rqq=sort={!func}myFunc() desc ?

or even as simple as


   1.
   http://localhost:8983/solr/0/select?q=edgengram:abc&wt=json&indent=true&debugQuery=true&rq={!rerank
   reRankQuery=$rqq reRankDocs=20}&rqq=sort=some_field desc

I am not able to get the last part right. I dont think my rqq is right.

--aj

On Fri, Sep 18, 2015 at 12:00 PM Joel Bernstein <jo...@gmail.com> wrote:

> The syntax would be something like this:
>
> q=hello+world&rq={!rerank reRankQuery=$rqq
> reRankDocs=100}&rqq={!func}myFunc()
>
> I'm not sure if there is a test case demonstrating this but it should work.
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Fri, Sep 18, 2015 at 2:42 PM, Ajinkya Kale <ka...@gmail.com>
> wrote:
>
> > Is there a way I can issue a regular query with q and then apply
> > functionQuery only on the top n documents of the result from q ?
> > Applying functionQuery on all documents will be very expensive in my
> case.
> > I am not able to find a way to "rerank" only top N documents using
> Function
> > Query.
> >
> > --aj
> >
> > On Fri, Sep 18, 2015 at 5:04 AM Joel Bernstein <jo...@gmail.com>
> wrote:
> >
> > > The ReRankQuery re-ranks the Top N documents of the main query based
> on a
> > > query. Rather then the CustomScoreQuery you may want to look at
> ReRanking
> > > by a Function Query using the FunctionQParserPlugin. This would allow
> you
> > > to directly control the ReRankScore for the top N documents.
> > >
> > > Writing your own RankQuery should be the last resort if you can't make
> a
> > > Function Query do what you need to do.
> > >
> > >
> > >
> > > Joel Bernstein
> > > http://joelsolr.blogspot.com/
> > >
> > > On Thu, Sep 17, 2015 at 10:44 PM, Ajinkya Kale <ka...@gmail.com>
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > I am new to Solr. I have a QParser plugin which uses an
> implementation
> > > > of CustomScoreQuery to provide custom score for each document.
> > > > Is there a way I can use the same plugin to provide score for top N
> > > > documents after an initial query/sort ?
> > > > I looked at the ReRankQParserPlugin but it looks lot more involved to
> > > write
> > > > a custom RankQuery implementation. So I was thinking if I can reuse
> my
> > > > existing CustomScoreQuery implementation to provide score for top N
> > > > documents to rerank.
> > > >
> > > > On a side note, is there a place where the ReRankQParserPlugin is
> > > explained
> > > > in detail ?
> > > >
> > > > --aj
> > > >
> > >
> >
>

Re: Question related to reranking and RankQuery

Posted by Joel Bernstein <jo...@gmail.com>.
The syntax would be something like this:

q=hello+world&rq={!rerank reRankQuery=$rqq
reRankDocs=100}&rqq={!func}myFunc()

I'm not sure if there is a test case demonstrating this but it should work.

Joel Bernstein
http://joelsolr.blogspot.com/

On Fri, Sep 18, 2015 at 2:42 PM, Ajinkya Kale <ka...@gmail.com> wrote:

> Is there a way I can issue a regular query with q and then apply
> functionQuery only on the top n documents of the result from q ?
> Applying functionQuery on all documents will be very expensive in my case.
> I am not able to find a way to "rerank" only top N documents using Function
> Query.
>
> --aj
>
> On Fri, Sep 18, 2015 at 5:04 AM Joel Bernstein <jo...@gmail.com> wrote:
>
> > The ReRankQuery re-ranks the Top N documents of the main query based on a
> > query. Rather then the CustomScoreQuery you may want to look at ReRanking
> > by a Function Query using the FunctionQParserPlugin. This would allow you
> > to directly control the ReRankScore for the top N documents.
> >
> > Writing your own RankQuery should be the last resort if you can't make a
> > Function Query do what you need to do.
> >
> >
> >
> > Joel Bernstein
> > http://joelsolr.blogspot.com/
> >
> > On Thu, Sep 17, 2015 at 10:44 PM, Ajinkya Kale <ka...@gmail.com>
> > wrote:
> >
> > > Hi all,
> > >
> > > I am new to Solr. I have a QParser plugin which uses an implementation
> > > of CustomScoreQuery to provide custom score for each document.
> > > Is there a way I can use the same plugin to provide score for top N
> > > documents after an initial query/sort ?
> > > I looked at the ReRankQParserPlugin but it looks lot more involved to
> > write
> > > a custom RankQuery implementation. So I was thinking if I can reuse my
> > > existing CustomScoreQuery implementation to provide score for top N
> > > documents to rerank.
> > >
> > > On a side note, is there a place where the ReRankQParserPlugin is
> > explained
> > > in detail ?
> > >
> > > --aj
> > >
> >
>

Re: Question related to reranking and RankQuery

Posted by Joel Bernstein <jo...@gmail.com>.
The syntax would be something like this:

q=hello+world&rq={!rerank reRankQuery=$rqq
reRankDocs=100}&rqq={!func}myFunc()

I'm not sure if there is a test case demonstrating this but it should work.

Joel Bernstein
http://joelsolr.blogspot.com/

On Fri, Sep 18, 2015 at 2:42 PM, Ajinkya Kale <ka...@gmail.com> wrote:

> Is there a way I can issue a regular query with q and then apply
> functionQuery only on the top n documents of the result from q ?
> Applying functionQuery on all documents will be very expensive in my case.
> I am not able to find a way to "rerank" only top N documents using Function
> Query.
>
> --aj
>
> On Fri, Sep 18, 2015 at 5:04 AM Joel Bernstein <jo...@gmail.com> wrote:
>
> > The ReRankQuery re-ranks the Top N documents of the main query based on a
> > query. Rather then the CustomScoreQuery you may want to look at ReRanking
> > by a Function Query using the FunctionQParserPlugin. This would allow you
> > to directly control the ReRankScore for the top N documents.
> >
> > Writing your own RankQuery should be the last resort if you can't make a
> > Function Query do what you need to do.
> >
> >
> >
> > Joel Bernstein
> > http://joelsolr.blogspot.com/
> >
> > On Thu, Sep 17, 2015 at 10:44 PM, Ajinkya Kale <ka...@gmail.com>
> > wrote:
> >
> > > Hi all,
> > >
> > > I am new to Solr. I have a QParser plugin which uses an implementation
> > > of CustomScoreQuery to provide custom score for each document.
> > > Is there a way I can use the same plugin to provide score for top N
> > > documents after an initial query/sort ?
> > > I looked at the ReRankQParserPlugin but it looks lot more involved to
> > write
> > > a custom RankQuery implementation. So I was thinking if I can reuse my
> > > existing CustomScoreQuery implementation to provide score for top N
> > > documents to rerank.
> > >
> > > On a side note, is there a place where the ReRankQParserPlugin is
> > explained
> > > in detail ?
> > >
> > > --aj
> > >
> >
>

Re: Question related to reranking and RankQuery

Posted by Ajinkya Kale <ka...@gmail.com>.
Is there a way I can issue a regular query with q and then apply
functionQuery only on the top n documents of the result from q ?
Applying functionQuery on all documents will be very expensive in my case.
I am not able to find a way to "rerank" only top N documents using Function
Query.

--aj

On Fri, Sep 18, 2015 at 5:04 AM Joel Bernstein <jo...@gmail.com> wrote:

> The ReRankQuery re-ranks the Top N documents of the main query based on a
> query. Rather then the CustomScoreQuery you may want to look at ReRanking
> by a Function Query using the FunctionQParserPlugin. This would allow you
> to directly control the ReRankScore for the top N documents.
>
> Writing your own RankQuery should be the last resort if you can't make a
> Function Query do what you need to do.
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Thu, Sep 17, 2015 at 10:44 PM, Ajinkya Kale <ka...@gmail.com>
> wrote:
>
> > Hi all,
> >
> > I am new to Solr. I have a QParser plugin which uses an implementation
> > of CustomScoreQuery to provide custom score for each document.
> > Is there a way I can use the same plugin to provide score for top N
> > documents after an initial query/sort ?
> > I looked at the ReRankQParserPlugin but it looks lot more involved to
> write
> > a custom RankQuery implementation. So I was thinking if I can reuse my
> > existing CustomScoreQuery implementation to provide score for top N
> > documents to rerank.
> >
> > On a side note, is there a place where the ReRankQParserPlugin is
> explained
> > in detail ?
> >
> > --aj
> >
>

Re: Question related to reranking and RankQuery

Posted by Ajinkya Kale <ka...@gmail.com>.
Is there a way I can issue a regular query with q and then apply
functionQuery only on the top n documents of the result from q ?
Applying functionQuery on all documents will be very expensive in my case.
I am not able to find a way to "rerank" only top N documents using Function
Query.

--aj

On Fri, Sep 18, 2015 at 5:04 AM Joel Bernstein <jo...@gmail.com> wrote:

> The ReRankQuery re-ranks the Top N documents of the main query based on a
> query. Rather then the CustomScoreQuery you may want to look at ReRanking
> by a Function Query using the FunctionQParserPlugin. This would allow you
> to directly control the ReRankScore for the top N documents.
>
> Writing your own RankQuery should be the last resort if you can't make a
> Function Query do what you need to do.
>
>
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Thu, Sep 17, 2015 at 10:44 PM, Ajinkya Kale <ka...@gmail.com>
> wrote:
>
> > Hi all,
> >
> > I am new to Solr. I have a QParser plugin which uses an implementation
> > of CustomScoreQuery to provide custom score for each document.
> > Is there a way I can use the same plugin to provide score for top N
> > documents after an initial query/sort ?
> > I looked at the ReRankQParserPlugin but it looks lot more involved to
> write
> > a custom RankQuery implementation. So I was thinking if I can reuse my
> > existing CustomScoreQuery implementation to provide score for top N
> > documents to rerank.
> >
> > On a side note, is there a place where the ReRankQParserPlugin is
> explained
> > in detail ?
> >
> > --aj
> >
>

Re: Question related to reranking and RankQuery

Posted by Joel Bernstein <jo...@gmail.com>.
The ReRankQuery re-ranks the Top N documents of the main query based on a
query. Rather then the CustomScoreQuery you may want to look at ReRanking
by a Function Query using the FunctionQParserPlugin. This would allow you
to directly control the ReRankScore for the top N documents.

Writing your own RankQuery should be the last resort if you can't make a
Function Query do what you need to do.



Joel Bernstein
http://joelsolr.blogspot.com/

On Thu, Sep 17, 2015 at 10:44 PM, Ajinkya Kale <ka...@gmail.com>
wrote:

> Hi all,
>
> I am new to Solr. I have a QParser plugin which uses an implementation
> of CustomScoreQuery to provide custom score for each document.
> Is there a way I can use the same plugin to provide score for top N
> documents after an initial query/sort ?
> I looked at the ReRankQParserPlugin but it looks lot more involved to write
> a custom RankQuery implementation. So I was thinking if I can reuse my
> existing CustomScoreQuery implementation to provide score for top N
> documents to rerank.
>
> On a side note, is there a place where the ReRankQParserPlugin is explained
> in detail ?
>
> --aj
>

Re: Question related to reranking and RankQuery

Posted by Joel Bernstein <jo...@gmail.com>.
The ReRankQuery re-ranks the Top N documents of the main query based on a
query. Rather then the CustomScoreQuery you may want to look at ReRanking
by a Function Query using the FunctionQParserPlugin. This would allow you
to directly control the ReRankScore for the top N documents.

Writing your own RankQuery should be the last resort if you can't make a
Function Query do what you need to do.



Joel Bernstein
http://joelsolr.blogspot.com/

On Thu, Sep 17, 2015 at 10:44 PM, Ajinkya Kale <ka...@gmail.com>
wrote:

> Hi all,
>
> I am new to Solr. I have a QParser plugin which uses an implementation
> of CustomScoreQuery to provide custom score for each document.
> Is there a way I can use the same plugin to provide score for top N
> documents after an initial query/sort ?
> I looked at the ReRankQParserPlugin but it looks lot more involved to write
> a custom RankQuery implementation. So I was thinking if I can reuse my
> existing CustomScoreQuery implementation to provide score for top N
> documents to rerank.
>
> On a side note, is there a place where the ReRankQParserPlugin is explained
> in detail ?
>
> --aj
>