The C API contains a very powerful undocumented method NSFSearchExtended3 to search for documents in a database using a formula, apply a filter to the documents to be scanned (e.g. an IDTable to search a subset of documents only or a filter to search soft deletions) and specify which summary buffer items to return in the result including the list of document readers and authors (as a special item "$C1$").
The method is perfect for incrementally indexing Domino data, building in-memory caches or even sync data to external systems.
The Domino JNA project wraps this method in the NotesSearch.search(...) method:
https://github.com/klehmann/domino-jna/blob/master/domino-jna/src/main/java/com/mindoo/domino/jna/NotesSearch.java#L361
It would be great to have this functionality added to the official Java/LS API as well.
The following parameters would be required:
- Selection formula
- Filter (e.g. DocumentCollection or a flag for "soft deletions")
- Since date (for incremental searches)
- items to return (map of item name and optional formula to compute values on the fly) or null to get the whole summary buffer
- Callback to receive result (noteid, UNID, creationdate, modifieddate, type: match/nonmatch/deletionstub, summary items, document readers)
And the method call would return a NotesDateTime value that can be used as next "since" value for incremental searches.
The method should not return documents and not return the whole summary buffer of the search matches to not kill search performance.
Please provide the complete functionality with all arguments that NSFSearchExtended3 provides (e.g. to search profile docs as well) and add convenience methods with less parameters for simple uses.
Getting non-matches and deletion stubs is critical as well so that we can update an external index when docs get deleted or modified to that they no longer match the selection formula.
Karsten Lehmann, Mindoo GmbH