Suppose I have a custom sorting 'DocScoreComparator' for computing distances on each search hit from a specified coordinate (similar to the DistanceComparatorSource example in LIA). Assume that the 'specified coordinate' is different for each query. This means a new custom comparator must be created for each query, which is ok. However, Lucene caches the comparator even though it will never be reused. This could result in heavy memory usage if many queries are performed before the IndexReader is updated.
Is there any way to avoid having lucene cache the custom sorting objects?