FAQ
Hi,

What is the best way to handle synonyms (phrases) using Lucene? Especially,
when I need to execute queries like :a OR b OR c NOT d

How about adding a new field called "synonyms" to each document while
indexing? This field's value would have a list of all synonyms. It would be
added to a document only when that document has any of the synonyms.

I would then execute an "OR" search query which would look for search
keyword in this field alongwith other fields.

Can this approach work well for any kind of query?

Please suggest.

Thanks.

--
View this message in context: http://www.nabble.com/Handling-synonyms-using-Lucene-tp24875308p24875308.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Search Discussions

  • Anshum at Aug 8, 2009 at 5:52 am
    Hi Mitu,
    Though your approach would work I'd suggest you build a custom analyzer
    instead. Perhaps that'd be a bettter approach.

    --
    Anshum Gupta
    Naukri Labs!
    http://ai-cafe.blogspot.com

    The facts expressed here belong to everybody, the opinions to me. The
    distinction is yours to draw............

    On Sat, Aug 8, 2009 at 11:14 AM, mitu2009 wrote:


    Hi,

    What is the best way to handle synonyms (phrases) using Lucene? Especially,
    when I need to execute queries like :a OR b OR c NOT d

    How about adding a new field called "synonyms" to each document while
    indexing? This field's value would have a list of all synonyms. It would be
    added to a document only when that document has any of the synonyms.

    I would then execute an "OR" search query which would look for search
    keyword in this field alongwith other fields.

    Can this approach work well for any kind of query?

    Please suggest.

    Thanks.

    --
    View this message in context:
    http://www.nabble.com/Handling-synonyms-using-Lucene-tp24875308p24875308.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Mitu2009 at Aug 9, 2009 at 4:02 pm
    Just wanted to add this my original question:
    FYI, The synonyms in my application are totally custom and not from English
    dictionary...ie. "Global Leader in Finance" could also mean "Top Investment
    Bank" or "Fortune 500 Finance company" etc etc.


    Anshum-2 wrote:
    Hi Mitu,
    Though your approach would work I'd suggest you build a custom analyzer
    instead. Perhaps that'd be a bettter approach.

    --
    Anshum Gupta
    Naukri Labs!
    http://ai-cafe.blogspot.com

    The facts expressed here belong to everybody, the opinions to me. The
    distinction is yours to draw............

    On Sat, Aug 8, 2009 at 11:14 AM, mitu2009 wrote:


    Hi,

    What is the best way to handle synonyms (phrases) using Lucene?
    Especially,
    when I need to execute queries like :a OR b OR c NOT d

    How about adding a new field called "synonyms" to each document while
    indexing? This field's value would have a list of all synonyms. It would
    be
    added to a document only when that document has any of the synonyms.

    I would then execute an "OR" search query which would look for search
    keyword in this field alongwith other fields.

    Can this approach work well for any kind of query?

    Please suggest.

    Thanks.

    --
    View this message in context:
    http://www.nabble.com/Handling-synonyms-using-Lucene-tp24875308p24875308.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
    --
    View this message in context: http://www.nabble.com/Handling-synonyms-using-Lucene-tp24875308p24888495.html
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedAug 8, '09 at 5:44a
activeAug 9, '09 at 4:02p
posts3
users2
websitelucene.apache.org

2 users in discussion

Mitu2009: 2 posts Anshum: 1 post

People

Translate

site design / logo © 2022 Grokbase