To safe resources during suggestion index recreation, we currently use a simple heuristic to check if the suggestion index needs to be update (= recreated): If the core search index is modified later than a namespace scoped suggestion index -> recreate the namespace suggestion index.

This means that if a document changes in namespace A, suggestion indexes will be recreated for all namespaces, while we only need to recreate it for namespace A (and the namespace unaware suggestion index).

Further improvement would be to use: DocumentFilteredIndexReader

Using DocumentFilteredIndexReader, we can compare its term enumerator with the one from the suggestion index. This way we don't need to create a temporary index to get this term enum for a single namespace, and by comparing both term enums we can skip recreation of a suggestion index when there are no changes.

Submitted by Elmer van Chastelet on 5 December 2012 at 11:55

On 5 December 2012 at 11:55 Elmer van Chastelet tagged search

On 23 December 2012 at 18:13 Elmer van Chastelet commented:

Unfortunately, term enumerator of a FilteredIndexReader returns the enumerator for the unfiltered index -> unusable.

Waiting for suggestions from lucene mailing list.

Log in to post comments