c# - Multi-phrase synonyms with Lucene .NET -
this question has answer here:
- synonyms using lucene 3 answers
i have application uses lucene.net , having trouble using synonyms feature of lucene multiple words in search phrase/term
for example if want search word "superman" , have setup synonym of : "spiderman" expect (and do) results related "spiderman" "superman"
now want search "justice league" , have synonym setup term "the avengers".
and "superman" , synonym "justice league".
you kinda going this. want in summary have ability setup multi phrase synonyms. aware synonyms indeed 1 word 1 word, there custom approach lucene.net or lucene in general people use around problem. heard lucene adding feature in havent seen far whilst looking around find useful.
thanks ed
look @ solr.synonymfilterfactory
keep in mind while synonymfilter happily work synonyms containing multiple words (ie: "sea biscuit, sea biscit, seabiscuit") recommended approach dealing synonyms this, expand synonym when indexing. because there 2 potential issues can arrise @ query time:
- the lucene queryparser tokenizes on white space before giving text analyzer, if person searches words sea biscit analyzer given words "sea" , "biscit" seperately, , not know match synonym.
- phrase searching (ie: "sea biscit") cause queryparser pass entire string analyzer, if synonymfilter configured expand synonyms, when queryparser gets resulting list of tokens analyzer, construct multiphrasequery not have desired effect. because of limited mechanism available analyzer indicate 2 terms occupy same position: there no way indicate "phrase" occupies same position term. our example resulting multiphrasequery "(sea | sea | seabiscuit) (biscuit | biscit)" not match simple case of "seabiscuit" occuring in document
Comments
Post a Comment