NestedDocsProvider shouldn't instantiate new IndexSearchers

Description

We have this code in NestedDocsProvider:

public DocIdSetIterator childDocs(LeafReaderContext context) throws IOException { final IndexReaderContext topLevelCtx = ReaderUtil.getTopLevelContext( context ); // Maybe we can cache on shard-base. See Elasticsearch code. IndexSearcher indexSearcher = new IndexSearcher( topLevelCtx ); Weight weight = childDocsWeight( indexSearcher ); return childDocs( weight, context ); }

It’s very suspicious that we have to instantiate a new indexSearcher for every single leaf.

We should find a way to either:

  • pass the index searcher to the NestedDocsProvider constructor

  • pass the index searcher to the childDocs() method

  • make the index searcher available through the topLevelCtx (somehow?)

Activity

Show:

Yoann Rodière March 21, 2022 at 10:03 AM

Turns out none of the solutions proposed in the description are easy to implement, and we don’t have proof that creating an IndexSearcher in NestedDocsProvider has a significant performance impact anyway. Closing.

Won't Do

Details

Assignee

Reporter

Components

Priority

Created March 18, 2022 at 5:24 PM
Updated March 21, 2022 at 10:03 AM
Resolved March 21, 2022 at 10:03 AM

Flag notifications