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 Michael Lissner <ml...@michaeljaylissner.com> on 2012/01/06 23:35:23 UTC

Synonym configuration not working?

I'm trying to set up some basic synonyms. The one I've been working on is:

us, usa, united states

My understanding is that adding that to the synonym file will allow 
users to search for US, and get back documents containing usa or united 
states. Ditto for if a user puts in usa or united states.

Unfortunately, with this in place, when I do a search, I get the results 
for items that contain all three of the words - it's doing an AND of the 
synonyms rather than an OR.

If I turn on debugging, this is indeed what I see (plus some stemming):
(+DisjunctionMaxQuery(((westCite:us westCite:usa westCite:unit) | 
(text:us text:usa text:unit) | (docketNumber:us docketNumber:usa 
docketNumber:unit) | ((status:us status:usa status:unit)^1.25) | 
(court:us court:usa court:unit) | (lexisCite:us lexisCite:usa 
lexisCite:unit) | ((caseNumber:us caseNumber:usa caseNumber:unit)^1.25) 
| ((caseName:us caseName:usa caseName:unit)^1.5))))/no_coord

Am I doing something wrong to cause this? My defaultOperator is set to 
AND, but I'd expect the synonym filter to understand that.

Any help?

Thanks,

Mike

Re: Synonym configuration not working?

Posted by Bernd Fehling <be...@uni-bielefeld.de>.
Yes and No.
If using Synonyms funtionality out of the box you have to do it at index time.

But if using it at query time, like we do, you have to do some programming.
We have connected a thesaurus which is actually using synonyms functionality at query time.
There are some pitfalls to take care of.

Bernd

Am 15.01.2012 07:07, schrieb Michael Lissner:
> Just replying for others in the future. The answer to this is to do synonyms at index time, not at query time.
>
> Mike
>
> On Fri 06 Jan 2012 02:35:23 PM PST, Michael Lissner wrote:
>> I'm trying to set up some basic synonyms. The one I've been working on is:
>>
>> us, usa, united states
>>
>> My understanding is that adding that to the synonym file will allow users to search for US, and get back documents containing usa or united
>> states. Ditto for if a user puts in usa or united states.
>>
>> Unfortunately, with this in place, when I do a search, I get the results for items that contain all three of the words - it's doing an AND of
>> the synonyms rather than an OR.
>>
>> If I turn on debugging, this is indeed what I see (plus some stemming):
>> (+DisjunctionMaxQuery(((westCite:us westCite:usa westCite:unit) | (text:us text:usa text:unit) | (docketNumber:us docketNumber:usa
>> docketNumber:unit) | ((status:us status:usa status:unit)^1.25) | (court:us court:usa court:unit) | (lexisCite:us lexisCite:usa lexisCite:unit)
>> | ((caseNumber:us caseNumber:usa caseNumber:unit)^1.25) | ((caseName:us caseName:usa caseName:unit)^1.5))))/no_coord
>>
>> Am I doing something wrong to cause this? My defaultOperator is set to AND, but I'd expect the synonym filter to understand that.
>>
>> Any help?
>>
>> Thanks,
>>
>> Mike

Re: Synonym configuration not working?

Posted by Michael Lissner <ml...@michaeljaylissner.com>.
Just replying for others in the future. The answer to this is to do 
synonyms at index time, not at query time.

Mike

On Fri 06 Jan 2012 02:35:23 PM PST, Michael Lissner wrote:
> I'm trying to set up some basic synonyms. The one I've been working on 
> is:
>
> us, usa, united states
>
> My understanding is that adding that to the synonym file will allow 
> users to search for US, and get back documents containing usa or 
> united states. Ditto for if a user puts in usa or united states.
>
> Unfortunately, with this in place, when I do a search, I get the 
> results for items that contain all three of the words - it's doing an 
> AND of the synonyms rather than an OR.
>
> If I turn on debugging, this is indeed what I see (plus some stemming):
> (+DisjunctionMaxQuery(((westCite:us westCite:usa westCite:unit) | 
> (text:us text:usa text:unit) | (docketNumber:us docketNumber:usa 
> docketNumber:unit) | ((status:us status:usa status:unit)^1.25) | 
> (court:us court:usa court:unit) | (lexisCite:us lexisCite:usa 
> lexisCite:unit) | ((caseNumber:us caseNumber:usa 
> caseNumber:unit)^1.25) | ((caseName:us caseName:usa 
> caseName:unit)^1.5))))/no_coord
>
> Am I doing something wrong to cause this? My defaultOperator is set to 
> AND, but I'd expect the synonym filter to understand that.
>
> Any help?
>
> Thanks,
>
> Mike