core-geonetwork icon indicating copy to clipboard operation
core-geonetwork copied to clipboard

LuceneSearcher - getAllMetadataFromIndexFor method processes even deleted documents

Open josegar74 opened this issue 4 years ago • 1 comments

LuceneSearcher.getMetadataFromIndex are used to retrieve directly the information from the index from the metadata id or uuid, the method uses LuceneSearcher.getMetadataFromIndex with a filter of type NoFilterFilter, but that filter seem retrieving even the deleted versions of the documents for a metadata (in case the index is not optimised), what can cause outdated information retrieved.

https://github.com/geonetwork/core-geonetwork/blob/cd80df109c3ee815eae6f3b2f1fe06cb884bd6de/core/src/main/java/org/fao/geonet/kernel/search/LuceneSearcher.java#L957-L958

Changing the filter to the following seem working fine, not retrieving outdated versions of the documents:

Filter filter = new DuplicateDocFilter(new MatchAllDocsQuery());

@fxprunayre are you familiar with this code? Before doing a pull request want to confirm I'm not missing something about the usage of NoFilterFilter.

josegar74 avatar Jan 22 '21 15:01 josegar74

No suggestion Jose.

fxprunayre avatar Jan 22 '21 15:01 fxprunayre