Apache Lucene open-source search software
Fix document exclusion in mlt query parser in Cloud mode for schemas that have non-'id' unique field
anshum44d8ee9115eb
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 9e4875be488..13e89c2f48e 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -259,6 +259,9 @@ Bug Fixes* SOLR-8145: Fix position of OOM killer script when starting Solr in the background (Jurian Broertjes viaTimothy Potter)+* SOLR-8769: Fix document exclusion in mlt query parser in Cloud mode for schemas that have non-"id"+ unique field (Erik Hatcher, Anshum Gupta)+Optimizations----------------------* SOLR-7876: Speed up queries and operations that use many terms when timeAllowed has not beendiff --git a/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java b/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.javaindex 114226fe302..f2ed8b973a0 100644--- a/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java+++ b/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java@@ -163,7 +163,7 @@ public class CloudMLTQParser extends QParser {BooleanQuery.Builder realMLTQuery = new BooleanQuery.Builder();realMLTQuery.setDisableCoord(true);realMLTQuery.add(boostedMLTQuery, BooleanClause.Occur.MUST);- realMLTQuery.add(createIdQuery("id", id), BooleanClause.Occur.MUST_NOT);+ realMLTQuery.add(createIdQuery(req.getSchema().getUniqueKeyField().getName(), id), BooleanClause.Occur.MUST_NOT);return realMLTQuery.build();} catch (IOException e) {