Description
For Lucene engine we use Lucene library to do the K-NN search. Lucene library doesn't take ef_search as a parameter and only takes k as a parameter. Due to this in k-NN query when ef_search is not passed as method parameters we just pass k which acts as ef_search and may lead to drop in recall and also less number of results. Ref: #2881
Solution
Ideally we should update the logic for Lucene engine and start doing this:
-
If ef_search is not passed in method parameters then
- Check if ef_search is set in index_mappings if not then use default ef_search based in index version else return the ef_search set on the index mappings
-
ef_search = max(k, ef_search)
-
Once Lucene query is completed reduce the number of results to final topK results.
This will ensure that we are always passing right value of ef_search parameter for Lucene engine.