In some circumstances, a NestedParent query does not return what it should (see attached code to reproduce).
First execute this code as-is. Output: "Found 1 document(s)" is ok.
Retry after uncommenting line 35. Output: "Found 0 document(s)" is wrong (should still find 1 document).
Additionnally, you can play with this example. If the
content of the line 35 is moved after the line 40, the correct result
will be observed again. Same if you do not move the line 35, but change the
firstname 'Philibert' to something else on this line, the correct result will be observed.
Using Whoosh 2.7.4 on Windows 10 with Python 3.10.4.
The bug comes if a document matches the 'children' criteria of the NestedParent query. but is itself not in any group, or not in a group matching the 'parent' criteria. This document has no reason be be returned and is not. But, the simple existence of this document makes that the query will not return any next result, even if other documents exists that should be returned by the query.