Thanks Mikhail and Michael. Based on your feedback, I created a ticket: https://issues.apache.org/jira/browse/SOLR-16652 In the ticket, I mentioned why updating the synonym rule or setting sow=true causes other problems in this case, unfortunately. I haven't yet looked through code to see where the behavior could be changed. Rudi
On Fri, Feb 10, 2023 at 11:26 AM Michael Gibney <mich...@michaelgibney.net> wrote: > Rudi, > > I agree, this does not seem like how it should behave. Probably > something that could be fixed in edismax, not something lower-level > (Lucene)? > > Michael > > On Fri, Feb 10, 2023 at 9:38 AM Mikhail Khludnev <m...@apache.org> wrote: > > > > Hello, Rudi. > > Well, it doesn't seem perfect. Probably it's can be fixed > > via > > foo bar,zzz,foo,bar > > And in some sort of sense this behavior is reasonable. > > Also you can experiment with sow and pf params (the later param is > > described in dismax page only). > > > > On Thu, Feb 9, 2023 at 8:19 PM Rudi Seitz <r...@rudiseitz.com> wrote: > > > > > Is this known behavior or is it worth a JIRA ticket? > > > > > > Searching against a text_general field in Solr 9.1, if my edismax > query is > > > "foo bar" I should be able to get matches for "foo" without "bar" and > vice > > > versa. However, if there happens to be a synonym rule applied at query > > > time, like "foo bar,zzz" I can no longer get single-term matches > against > > > "foo" or "bar." Both terms are now required, but can occur in either > order. > > > If we change the text_general analysis chain to apply synonyms at index > > > time instead of query time, this behavior goes away and single-term > matches > > > are again possible. > > > > > > To reproduce, use the _default configset with "foo bar,zzz" added to > > > synonyms.txt. Index these four docs: > > > > > > {"id":"1", "title_txt":"foo"} > > > {"id":"2", "title_txt":"bar"} > > > {"id":"3", "title_txt":"foo bar"} > > > {"id":"4", "title_txt":"bar foo"} > > > > > > Issue a query for "foo bar" (i.e. > > > defType=edismax&q.op=OR&qf=title_txt&q=foo bar) > > > Result: Only docs 3 and 4 come back > > > > > > Issue a query for "bar foo" > > > Result: All four docs come back; the synonym rule is not invoked > > > > > > Looking at the explain output for "foo bar" we see: > > > > > > +((title_txt:zzz (+title_txt:foo +title_txt:bar))) > > > > > > > > > Looking at the explain output for "bar foo" we see: > > > > > > +((title_txt:bar) (title_txt:foo)) > > > > > > So, the observed behavior makes sense according to the low-level query > > > structure. But -- is this how it's "supposed" to work? > > > > > > Why not expand the "foo bar" query like this instead? > > > > > > +((title_txt:zzz (title_txt:foo title_txt:bar))) > > > > > > Rudi > > > > > > > > > -- > > Sincerely yours > > Mikhail Khludnev > > https://t.me/MUST_SEARCH > > A caveat: Cyrillic! >