Re: BooleanQuery rewrite optimization

2016-08-15 Thread Spyros Kapnissis
Ok! I will open an issue in JIRA then. On Saturday, August 13, 2016 3:26 PM, Adrien Grand wrote: The explanation makes sense, I think you're right. Even though I don't think this optimization would be used often, it would certainly help performance when it is used. Le sam.

Re: BooleanQuery rewrite optimization

2016-08-13 Thread Adrien Grand
The explanation makes sense, I think you're right. Even though I don't think this optimization would be used often, it would certainly help performance when it is used. Le sam. 13 août 2016 à 12:21, Spyros Kapnissis a écrit : > Ok, I had some time to look a bit further

Re: BooleanQuery rewrite optimization

2016-08-13 Thread Spyros Kapnissis
Ok, I had some time to look a bit further into it. It seems that indeed a SHOULD clause with FILTER is equivalent with an AND clause with a minShouldMatch of -1 in terms of both the number of results and score. My reasoning goes like this: given:- a single clause both as a SHOULD and a FILTER is

Re: BooleanQuery rewrite optimization

2016-08-10 Thread Adrien Grand
I'm not awaken enough to figure out whether the -1 trick is right or not, but if you manage to prove it somehow, patches to simplify boolean queries at rewrite time are welcome! Le mar. 9 août 2016 à 00:47, Spyros Kapnissis a écrit : > Hm, I hadn't really thought about

Re: BooleanQuery rewrite optimization

2016-08-08 Thread Spyros Kapnissis
Hm, I hadn't really thought about the minShouldMatch part, I thought it' d be covered but I see your point being semantically different if you keep it as is. However.. Running your edge case example on an actual local index I get the following: "(X X Y #X)" w/minshouldmatch=2 vs. (+X X Y)

Re: BooleanQuery rewrite optimization

2016-08-08 Thread Chris Hostetter
Off the top of my head, i think any optimiation like that would also need to account for minNrShouldMatch, wouldn't it? if your query is "(X Y Z #X)" w/minshouldmatch=2, and you rewrite that query to "(+X Y Z)" w/minshouldmatch=2 you now have a semantically diff query that won't match as many

BooleanQuery rewrite optimization

2016-08-08 Thread Spyros Kapnissis
Hello all, I noticed while debugging a query that BooleanQuery will rewrite itself to remove FILTER clauses that are also MUST as an optimization/simplification, which makes total sense. So (+f:x #f:x) will become (+f:x). However, shouldn't there also be another optimization to remove FILTER