Did you notice that the Filter instance is invoked multiple times? The filter needs to be applied on each sub-reader: you will get a reader instance to process for each segment in the index; considering that after each change you make to the index the set of segments changes, adding a new element like in your test means you'll be processing at least two segments.
you're not operating on sub-readers but on a recursive IndexReader which includes all current segments.
Why: filtering needs to be applied on a per-segment basis to make caching more effective: each cached DocIdSet is kept around for the validity of each segment, so you won't invalidate all processing for each minimal change on the index.
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
Hi Clark,
I developed a functional test to verify this, could you please have a look at it:
https://github.com/Sanne/hibernate-search/blob/acb4d6e833e80f5b35b94bf09041bf624648422a/hibernate-search-engine/src/test/java/org/hibernate/search/test/filters/FreshReadersProvidedTest.java
Did you notice that the Filter instance is invoked multiple times? The filter needs to be applied on each sub-reader: you will get a reader instance to process for each segment in the index; considering that after each change you make to the index the set of segments changes, adding a new element like in your test means you'll be processing at least two segments.
Note that when you invoke
Why: filtering needs to be applied on a per-segment basis to make caching more effective: each cached DocIdSet is kept around for the validity of each segment, so you won't invalidate all processing for each minimal change on the index.