Rewrite SynonymQuery to support payloads

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Rewrite SynonymQuery to support payloads

Markus Jelsma-2
Hello,

To support payloads we rewrite SynonymQuery to a pair of SpanTerm queries which we then can wrap in the PayloadScoreQuery. This is not the right way to do this because if both clauses match, both are also scored.  We could try to rewrite SynonymQuery to a SpanOrQuery but i suppose that would also cause both clauses to score if they match.

So, how can i transform a SynonymQuery into something that i can wrap into PayloadScoreQuery on Lucene/Solr 7.x?

Many thanks,
Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Rewrite SynonymQuery to support payloads

Alessandro Benedetti-4
Hi Markus,
I contributed to Solr this exact part :

https://issues.apache.org/jira/browse/SOLR-12238

Patch and Pull Request is attached but it has not been reviewed yet.
Give it a look, and then we can continue the discussion here!
let me know if you feel your requirement is different !

Cheers

On Wed, May 23, 2018 at 11:41 AM, Markus Jelsma <[hidden email]>
wrote:

> Hello,
>
> To support payloads we rewrite SynonymQuery to a pair of SpanTerm queries
> which we then can wrap in the PayloadScoreQuery. This is not the right way
> to do this because if both clauses match, both are also scored.  We could
> try to rewrite SynonymQuery to a SpanOrQuery but i suppose that would also
> cause both clauses to score if they match.
>
> So, how can i transform a SynonymQuery into something that i can wrap into
> PayloadScoreQuery on Lucene/Solr 7.x?
>
> Many thanks,
> Markus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
--------------------------

Benedetti Alessandro
Visiting card - http://about.me/alessandro_benedetti
Blog - http://alexbenedetti.blogspot.co.uk

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England
Reply | Threaded
Open this post in threaded view
|

RE: Rewrite SynonymQuery to support payloads

Markus Jelsma-2
In reply to this post by Markus Jelsma-2
Hello Alessandro,

I was looking for something more light weight, or extend SpanOrQuery to support this case. The rewrite is part of our custom parser extending ExtendedDismaxQParser where we add support for payloads by rewriting everything to a payload equivalent.

This is almost the case with SpanOrQuery, i think, but i need to know how i can let it score just once. Where do i need to put this logic? Reading SynonymQuery code doesn't make it obvious to me right away. Do i need to look into Scorer logic, or Weight logic? What building blocks do i need, what parts of SynonymQuery could i borrow, and what not?

Or, if there is a better way, should i instead try to add payload support to an extended SynonymQuery, would that be easier? And how should i do that?

What would be the best to tackle this issue?

Many thanks,
Markus

-----Original message-----

> From:Alessandro Benedetti <[hidden email]>
> Sent: Wednesday 23rd May 2018 13:01
> To: [hidden email]
> Subject: Re: Rewrite SynonymQuery to support payloads
>
> Hi Markus,
> I contributed to Solr this exact part :
>
> https://issues.apache.org/jira/browse/SOLR-12238
>
> Patch and Pull Request is attached but it has not been reviewed yet.
> Give it a look, and then we can continue the discussion here!
> let me know if you feel your requirement is different !
>
> Cheers
>
> On Wed, May 23, 2018 at 11:41 AM, Markus Jelsma <[hidden email]>
> wrote:
>
> > Hello,
> >
> > To support payloads we rewrite SynonymQuery to a pair of SpanTerm queries
> > which we then can wrap in the PayloadScoreQuery. This is not the right way
> > to do this because if both clauses match, both are also scored.  We could
> > try to rewrite SynonymQuery to a SpanOrQuery but i suppose that would also
> > cause both clauses to score if they match.
> >
> > So, how can i transform a SynonymQuery into something that i can wrap into
> > PayloadScoreQuery on Lucene/Solr 7.x?
> >
> > Many thanks,
> > Markus
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
> --
> --------------------------
>
> Benedetti Alessandro
> Visiting card - http://about.me/alessandro_benedetti
> Blog - http://alexbenedetti.blogspot.co.uk
>
> "Tyger, tyger burning bright
> In the forests of the night,
> What immortal hand or eye
> Could frame thy fearful symmetry?"
>
> William Blake - Songs of Experience -1794 England

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]