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 along with other fields.
Can this approach work well for any kind of query?
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.
Please suggest.
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…