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 davym <dm...@luon.com> on 2015/02/21 08:52:27 UTC
Solr synonyms logic
Hi all,
I'm querying a recipe database in Solr. By using synonyms, I'm trying to
make my search a little smarter.
What I'm trying to do here, is that a search for pastry returns all lasagne,
penne & cannelloni recipes.
However a search for lasagne should only return lasagne recipes.
In my synonyms.txt, I have these lines:
---------------------
lasagne,pastry
penne,pastry
cannelloni,pastry
---------------------
Filter in my scheme.xml looks like this:
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"
tokenizerFactory="solr.WhitespaceTokenizerFactory" />
Only in the index analyzer, not in the query.
When using the Solr analysis tool, I can see that my index for lasagne has a
synonym pastry and my query only queries lasagne. Same for penne and
cannelloni, they both have the synonym pastry.
Currently my Solr query for lasagne also returns all penne and cannelloni
recipes. I cannot understand why this is the case.
Can someone explain this behaviour to me please?
--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-synonyms-logic-tp4187827.html
Sent from the Solr - User mailing list archive at Nabble.com.
RE: Solr synonyms logic
Posted by steve <sc...@hotmail.com>.
SEO is search fun subject!http://www.academia.edu/1033371/Hyponymy_extraction_and_web_search_behavior_analysis_based_on_query_reformulation
planeta terra (planet earth),planeta (planet).Conclusion : Planet earth is a hyponym of planetplaneta terra (planet earth),planeta (planet).Conclusion : Planet earth is a hyponym of planet
> Date: Sat, 21 Feb 2015 08:12:33 -0800
> Subject: Re: Solr synonyms logic
> From: rjosal@gmail.com
> To: solr-user@lucene.apache.org
>
> What you are describing is hyponymy. Pastry is the hypernym. You can
> accomplish this by not using expansion, for example:
> cannelloni => cannelloni, pastry
>
> This has the result of adding pastry to the index.
>
> Ryan
>
> On Saturday, February 21, 2015, Mikhail Khludnev <mk...@griddynamics.com>
> wrote:
>
> > Hello,
> >
> > usually debugQuery=true output explains a lot of such details.
> >
> > On Sat, Feb 21, 2015 at 10:52 AM, davym <dmeybos@luon.com <javascript:;>>
> > wrote:
> >
> > > Hi all,
> > >
> > > I'm querying a recipe database in Solr. By using synonyms, I'm trying to
> > > make my search a little smarter.
> > >
> > > What I'm trying to do here, is that a search for pastry returns all
> > > lasagne,
> > > penne & cannelloni recipes.
> > > However a search for lasagne should only return lasagne recipes.
> > >
> > > In my synonyms.txt, I have these lines:
> > > ---------------------
> > > lasagne,pastry
> > > penne,pastry
> > > cannelloni,pastry
> > > ---------------------
> > >
> > > Filter in my scheme.xml looks like this:
> > > <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> > > ignoreCase="true" expand="true"
> > > tokenizerFactory="solr.WhitespaceTokenizerFactory" />
> > > Only in the index analyzer, not in the query.
> > >
> > > When using the Solr analysis tool, I can see that my index for lasagne
> > has
> > > a
> > > synonym pastry and my query only queries lasagne. Same for penne and
> > > cannelloni, they both have the synonym pastry.
> > >
> > > Currently my Solr query for lasagne also returns all penne and cannelloni
> > > recipes. I cannot understand why this is the case.
> > >
> > > Can someone explain this behaviour to me please?
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > > http://lucene.472066.n3.nabble.com/Solr-synonyms-logic-tp4187827.html
> > > Sent from the Solr - User mailing list archive at Nabble.com.
> > >
> >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> > Principal Engineer,
> > Grid Dynamics
> >
> > <http://www.griddynamics.com>
> > <mkhludnev@griddynamics.com <javascript:;>>
>
Re: Solr synonyms logic
Posted by Ryan Josal <rj...@gmail.com>.
What you are describing is hyponymy. Pastry is the hypernym. You can
accomplish this by not using expansion, for example:
cannelloni => cannelloni, pastry
This has the result of adding pastry to the index.
Ryan
On Saturday, February 21, 2015, Mikhail Khludnev <mk...@griddynamics.com>
wrote:
> Hello,
>
> usually debugQuery=true output explains a lot of such details.
>
> On Sat, Feb 21, 2015 at 10:52 AM, davym <dmeybos@luon.com <javascript:;>>
> wrote:
>
> > Hi all,
> >
> > I'm querying a recipe database in Solr. By using synonyms, I'm trying to
> > make my search a little smarter.
> >
> > What I'm trying to do here, is that a search for pastry returns all
> > lasagne,
> > penne & cannelloni recipes.
> > However a search for lasagne should only return lasagne recipes.
> >
> > In my synonyms.txt, I have these lines:
> > ---------------------
> > lasagne,pastry
> > penne,pastry
> > cannelloni,pastry
> > ---------------------
> >
> > Filter in my scheme.xml looks like this:
> > <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> > ignoreCase="true" expand="true"
> > tokenizerFactory="solr.WhitespaceTokenizerFactory" />
> > Only in the index analyzer, not in the query.
> >
> > When using the Solr analysis tool, I can see that my index for lasagne
> has
> > a
> > synonym pastry and my query only queries lasagne. Same for penne and
> > cannelloni, they both have the synonym pastry.
> >
> > Currently my Solr query for lasagne also returns all penne and cannelloni
> > recipes. I cannot understand why this is the case.
> >
> > Can someone explain this behaviour to me please?
> >
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> > http://lucene.472066.n3.nabble.com/Solr-synonyms-logic-tp4187827.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
> Principal Engineer,
> Grid Dynamics
>
> <http://www.griddynamics.com>
> <mkhludnev@griddynamics.com <javascript:;>>
>
Re: Solr synonyms logic
Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Hello,
usually debugQuery=true output explains a lot of such details.
On Sat, Feb 21, 2015 at 10:52 AM, davym <dm...@luon.com> wrote:
> Hi all,
>
> I'm querying a recipe database in Solr. By using synonyms, I'm trying to
> make my search a little smarter.
>
> What I'm trying to do here, is that a search for pastry returns all
> lasagne,
> penne & cannelloni recipes.
> However a search for lasagne should only return lasagne recipes.
>
> In my synonyms.txt, I have these lines:
> ---------------------
> lasagne,pastry
> penne,pastry
> cannelloni,pastry
> ---------------------
>
> Filter in my scheme.xml looks like this:
> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="true"
> tokenizerFactory="solr.WhitespaceTokenizerFactory" />
> Only in the index analyzer, not in the query.
>
> When using the Solr analysis tool, I can see that my index for lasagne has
> a
> synonym pastry and my query only queries lasagne. Same for penne and
> cannelloni, they both have the synonym pastry.
>
> Currently my Solr query for lasagne also returns all penne and cannelloni
> recipes. I cannot understand why this is the case.
>
> Can someone explain this behaviour to me please?
>
>
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Solr-synonyms-logic-tp4187827.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics
<http://www.griddynamics.com>
<mk...@griddynamics.com>