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 lorenzo zhak <zh...@gmail.com> on 2007/07/12 02:02:08 UTC

Question about synonyms

Hi,

I'm actually working on a project where we recently add Solr.
The project is extenselvy based on synonyms and I'm actually faced
with a problem concerning multi words synonyms.

Here is my problem:

giving the user search expression
"A B C D"
where a single letter stand for a term.
and with a synonyms lists that looks like :

F, A
G, B
I J, A B
O K, C D

I actually made two synonyms field search :

q=myfield:(A B C D) OR myfield:("A B C D")

looking at the Debugging mode in Solr admin, I conlude that the Lucene
query generated made a search on:

(myfield:F OR myfield:G OR myfield:C OR myfield:D) OR
(PhraseQuery(myfield:"I J O K")

so for what I understand, a "normal" search (eg without surrouding it
with double quote) made a search replacing every single terms in the
query with the first equivalent synonyms founded on the left side of
the list)

and a phrase search while launch a phrase query by replacing every
sub-expressions founded in the global expression with the left side
corresponding synonyms expression founded in the list.

But what my client is actually expecting is a search engine that
identify sub expressions synonym in a query and replace it with the
given synonym expression, and finally launch a query that ask for
every single transormed terms

So the phrase query looks like exactly what he's looking for, expect
that the PhraseQuery will, for what I conclude, gives only the result
that correspond to the exact synonyms transformed "phrase" in a
document.

Brievly, what I'm looking for is a query that launch something like this:

Giving the user search expression
"A B C D"

Generated Lucene query :
(myfield:I OR myfield:J OR myfield:O OR myfield:K)

if someone knows a way to reach this goal, please tell me how, i'm
actually tearing my hairs on this issues and I really appreciate some
help !!

Thanks you, and thanks to the solr team for this amazing product that
really improved by x100 the performance of our search engine !

Laurent