You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2023/03/01 17:24:07 UTC

[solr] branch branch_9x updated: SOLR-16656: rid parameter missing from query logs (#1364)

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 628c64a9209 SOLR-16656: rid parameter missing from query logs (#1364)
628c64a9209 is described below

commit 628c64a920968d797ec49850d9fbdefedd5bc62c
Author: Alex <st...@users.noreply.github.com>
AuthorDate: Wed Mar 1 09:17:38 2023 -0800

    SOLR-16656: rid parameter missing from query logs (#1364)
---
 solr/CHANGES.txt                                     |  2 ++
 .../apache/solr/handler/component/SearchHandler.java | 20 +++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c8855eb016f..1d14ecbff9e 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -204,6 +204,8 @@ Bug Fixes
 * SOLR-16682: MoreLikeThis Component fails with SyntaxError: Cannot parse if document terms contains symbols from query parser syntax 
   (Mikhail Khludnev)
 
+* SOLR-16656: rid parameter missing from query logs (Alex Deparvu)
+
 Build
 ---------------------
 * Upgrade forbiddenapis to 3.4 (Uwe Schindler)
diff --git a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
index d670ed954ad..636f5303849 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
@@ -272,18 +272,23 @@ public class SearchHandler extends RequestHandlerBase
     return result;
   }
 
+  private boolean isDistrib(SolrQueryRequest req) {
+    boolean isZkAware = req.getCoreContainer().isZooKeeperAware();
+    boolean isDistrib = req.getParams().getBool(DISTRIB, isZkAware);
+    if (!isDistrib) {
+      // for back compat, a shards param with URLs like localhost:8983/solr will mean that this
+      // search is distributed.
+      final String shards = req.getParams().get(ShardParams.SHARDS);
+      isDistrib = ((shards != null) && (shards.indexOf('/') > 0));
+    }
+    return isDistrib;
+  }
+
   public ShardHandler getAndPrepShardHandler(SolrQueryRequest req, ResponseBuilder rb) {
     ShardHandler shardHandler = null;
 
     CoreContainer cc = req.getCoreContainer();
     boolean isZkAware = cc.isZooKeeperAware();
-    rb.isDistrib = req.getParams().getBool(DISTRIB, isZkAware);
-    if (!rb.isDistrib) {
-      // for back compat, a shards param with URLs like localhost:8983/solr will mean that this
-      // search is distributed.
-      final String shards = req.getParams().get(ShardParams.SHARDS);
-      rb.isDistrib = ((shards != null) && (shards.indexOf('/') > 0));
-    }
 
     if (rb.isDistrib) {
       shardHandler = shardHandlerFactory.getShardHandler();
@@ -338,6 +343,7 @@ public class SearchHandler extends RequestHandlerBase
       rb.requestInfo.setResponseBuilder(rb);
     }
 
+    rb.isDistrib = isDistrib(req);
     tagRequestWithRequestId(rb);
 
     boolean dbg = req.getParams().getBool(CommonParams.DEBUG_QUERY, false);