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 Vergantini Luca <l....@reply.it> on 2018/09/03 13:41:28 UTC

Contextual Synonym Filter

I need to create a contextual Synonym Filter:

I need that the Synonym Filter load different synonym configuration based on the fq query parameter.

I've already modified the SynonymGraphFilterFactory to load from DB (this is another requirement) but I can't understand how to make the fq parameter arrive to the Factory.

Maybe I need a Query Parser plugin?

Please help


Luca Vergantini

Whitehall Reply
Via del Giorgione, 59
00147 - Roma - ITALY
phone: +39 06 844341
l.vergantini@reply.it<ma...@reply.it>
www.reply.it

[Whitehall Reply]

Re: Contextual Synonym Filter

Posted by Ryan Yacyshyn <ry...@gmail.com>.
Hi Luca,

I wonder if payloads might be able to solve your case for contextual
synonyms?

http://jorgelbg.github.io/posts/solr-contextual-synonyms

Ryan





On Mon, 3 Sep 2018 at 21:59 Andrea Gazzarini <a....@sease.io> wrote:

> Hi Luca,
> I believe this is not an easy task to do passing through Solr/Lucene
> internals; did you try to use what Solr offers out of the box?
> For example, you could define several fields associated where each
> corresponding field type uses a different synonym set. So you would have
>
>   * F1 -> FT1 -> SYNSET1
>   * F2 -> FT2 -> SYNSET2
>   * ...
>
> if you query using *fq=F1:something* then the *FT1* (and the *SYNSET1*)
> will be used, if you query using *fq=F2:something* then the *FT2* (and
> the *SYNSET2*) will be used, and so on
>
> I don't know your context so my suggestion could be absolutely in the
> wrong path
>
> Best,
> Andrea
>
> On 03/09/2018 15:41, Vergantini Luca wrote:
> >
> > I need to create a contextual Synonym Filter:
> >
> > I need that the Synonym Filter load different synonym configuration
> > based on the fq query parameter.
> >
> > I’ve already modified the SynonymGraphFilterFactory to load from DB
> > (this is another requirement) but I can’t understand how to make the
> > fq parameter arrive to the Factory.
> >
> > Maybe I need a Query Parser plugin?
> >
> > Please help
> >
> >
> >
> > Luca Vergantini
> >
> > Whitehall Reply
> > Via del Giorgione, 59
> > 00147 - Roma - ITALY
> > phone: +39 06 844341 <+39%2006%20844341>
> > l.vergantini@reply.it <ma...@reply.it>
> > www.reply.it
> >
> > Whitehall Reply
>
>

Re: Contextual Synonym Filter

Posted by Andrea Gazzarini <a....@sease.io>.
Hi Luca,
I believe this is not an easy task to do passing through Solr/Lucene 
internals; did you try to use what Solr offers out of the box?
For example, you could define several fields associated where each 
corresponding field type uses a different synonym set. So you would have

  * F1 -> FT1 -> SYNSET1
  * F2 -> FT2 -> SYNSET2
  * ...

if you query using *fq=F1:something* then the *FT1* (and the *SYNSET1*) 
will be used, if you query using *fq=F2:something* then the *FT2* (and 
the *SYNSET2*) will be used, and so on

I don't know your context so my suggestion could be absolutely in the 
wrong path

Best,
Andrea

On 03/09/2018 15:41, Vergantini Luca wrote:
>
> I need to create a contextual Synonym Filter:
>
> I need that the Synonym Filter load different synonym configuration 
> based on the fq query parameter.
>
> I’ve already modified the SynonymGraphFilterFactory to load from DB 
> (this is another requirement) but I can’t understand how to make the 
> fq parameter arrive to the Factory.
>
> Maybe I need a Query Parser plugin?
>
> Please help
>
>
>
> Luca Vergantini
>
> Whitehall Reply
> Via del Giorgione, 59
> 00147 - Roma - ITALY
> phone: +39 06 844341
> l.vergantini@reply.it <ma...@reply.it>
> www.reply.it
>
> Whitehall Reply