backport search_lucene fixes to stable5