Hello. 1)Yes. That's the purpose. 2) I've skimmed through QueryBuilder.java. Conclusion is that it creates BQ.SHOULD (however, there should be something like DisjunctionMaxQuery) over PhraseQuery or MultiPhraseQuery (-ies). Good hack!
On Wed, Dec 28, 2022 at 2:23 AM Anh Dũng Bùi <dungba...@gmail.com> wrote: > Hi Lucene users, > > I recently came across SynonymQuery and found out that it only supports > single-term synonyms (since it accepts a list of Term which will be > considered as synonyms). We have some multi-term synonyms like "internet > device" <-> "wifi router" or "dns" <-> "domain name service". Am I right > that I need to use something like a BooleanQuery for these cases? > > I have 2 other follow-up questions: > - Does SynonymQuery have any advantage over BooleanQuery? Or is it only > different in how scores are computed? As I understand SynonymWeight will > consider all terms as exactly the same while BooleanQuery will favor the > documents with more matched terms. > - Is it worth it to support multi-term synonyms in SynonymQuery? My feeling > is that it's better to just use BooleanQuery in those cases, since to > support multi-term synonyms it needs to accept a list of Query, which would > make it behave like a BooleanQuery. Also how scoring works with multi-term > is another problem. > > Thanks & Regards! > -- Sincerely yours Mikhail Khludnev