问题
All:
I want to do a multi-word synonym search, to get search to work like:
"small dog" means puppy
"cute small cat" may refer to kitten
[1] I do not know how to define those multi-word phrase in synonyms.txt to make it work. Could anyone ell me how to define those phrase in synonyms.txt
[2] Another thing is: Once the synonym can work, how can I match both "small dog" and "little dog" which have similar meaning with puppy? Like:
"a small dog" also means "small dog" means puppy
"cute cat" may refer to "cute small cat" may refer to kitten
( I mean if there is any way we can collapse the phrase which has similar meaning and words into the synonym phrase which is in the synonym list)
Thanks
回答1:
It could be done very easily.
In synonyms file you need to write something like this:
small dog => puppy
According to second question:
a small dog => puppy
little dog => puppy
=> in Solr synonyms file means 1-way synonym, if you want to to have 2-way synonyms, you need to list them with comma as a delimeter.
For more info about synonyms in Solr - https://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory
来源:https://stackoverflow.com/questions/28158870/good-way-to-do-multi-word-synonym-search