You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by cp...@apache.org on 2024/02/14 11:21:44 UTC

(solr) branch jira/solr-13350 updated (85b783ecbbc -> c69006a4ca6)

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

cpoerschke pushed a change to branch jira/solr-13350
in repository https://gitbox.apache.org/repos/asf/solr.git


    from 85b783ecbbc Merge branch 'main' into jira/solr-13350
     new 947d84132f0 minor: SolrIndexSearcher style: add couple of finals
     new c69006a4ca6 factor out SolrIndexSearcher.allowMT(Query) utility; add SolrIndexSearcher.MTCollectorQueryCheck class-level javadocs;

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/solr/search/SolrIndexSearcher.java  | 28 ++++++++++++++--------
 1 file changed, 18 insertions(+), 10 deletions(-)


(solr) 01/02: minor: SolrIndexSearcher style: add couple of finals

Posted by cp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cpoerschke pushed a commit to branch jira/solr-13350
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 947d84132f0e234971341cb47babd3f8940f2b65
Author: Christine Poerschke <cp...@apache.org>
AuthorDate: Wed Feb 14 10:24:06 2024 +0000

    minor: SolrIndexSearcher style: add couple of finals
---
 solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
index c507dd71197..e2c0eb36a97 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
@@ -1901,7 +1901,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
           maxScoreCollector = new MaxScoreCollector();
           collector = MultiCollector.wrap(topCollector, maxScoreCollector);
         }
-        ScoreMode scoreModeUsed =
+        final ScoreMode scoreModeUsed =
             buildAndRunCollectorChain(qr, query, collector, cmd, pf.postFilter).scoreMode();
 
         totalHits = topCollector.getTotalHits();
@@ -1926,10 +1926,10 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
         if (log.isInfoEnabled()) {
           log.info("using CollectorManager");
         }
-        SearchResult searchResult =
+        final SearchResult searchResult =
             searchCollectorManagers(len, cmd, query, true, needScores, false);
-        Object[] res = searchResult.result;
-        TopDocsResult result = (TopDocsResult) res[0];
+        final Object[] res = searchResult.result;
+        final TopDocsResult result = (TopDocsResult) res[0];
 
         totalHits = result.totalHits;
         topDocs = result.topDocs;


(solr) 02/02: factor out SolrIndexSearcher.allowMT(Query) utility; add SolrIndexSearcher.MTCollectorQueryCheck class-level javadocs;

Posted by cp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cpoerschke pushed a commit to branch jira/solr-13350
in repository https://gitbox.apache.org/repos/asf/solr.git

commit c69006a4ca6625307e17fb0c272b08eebacd9a69
Author: Christine Poerschke <cp...@apache.org>
AuthorDate: Wed Feb 14 11:19:23 2024 +0000

    factor out SolrIndexSearcher.allowMT(Query) utility; add SolrIndexSearcher.MTCollectorQueryCheck class-level javadocs;
---
 .../org/apache/solr/search/SolrIndexSearcher.java    | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
index e2c0eb36a97..d5d6a5193aa 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
@@ -1884,13 +1884,12 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
       if (log.isInfoEnabled()) {
         log.info("calling from 2, query: {}", query.getClass());
       }
-      MTCollectorQueryCheck allowMT = new MTCollectorQueryCheck();
-      query.visit(allowMT);
+      final boolean allowMT = allowMT(query);
       final TopDocs topDocs;
       if (pf.postFilter != null
           || cmd.getSegmentTerminateEarly()
           || cmd.getTimeAllowed() > 0
-          || !allowMT.allowed()) {
+          || !allowMT) {
         if (log.isInfoEnabled()) {
           log.info("skipping collector manager");
         }
@@ -2234,13 +2233,12 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
       // no docs on this page, so cursor doesn't change
       qr.setNextCursorMark(cmd.getCursorMark());
     } else {
-      MTCollectorQueryCheck allowMT = new MTCollectorQueryCheck();
-      query.visit(allowMT);
+      final boolean allowMT = allowMT(query);
       TopDocs topDocs;
       if (pf.postFilter != null
           || cmd.getSegmentTerminateEarly()
           || cmd.getTimeAllowed() > 0
-          || !allowMT.allowed()) {
+          || !allowMT) {
         @SuppressWarnings({"rawtypes"})
         final TopDocsCollector<? extends ScoreDoc> topCollector = buildTopDocsCollector(len, cmd);
         DocSetCollector setCollector = new DocSetCollector(maxDoc);
@@ -2925,6 +2923,16 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
     return warmupTime;
   }
 
+  private static boolean allowMT(Query query) {
+    MTCollectorQueryCheck allowMT = new MTCollectorQueryCheck();
+    query.visit(allowMT);
+    return allowMT.allowed();
+  }
+
+  /**
+   * A {@link QueryVisitor} that recurses through the query tree, determining if all queries support
+   * multi-threaded collecting.
+   */
   private static class MTCollectorQueryCheck extends QueryVisitor {
 
     private QueryVisitor subVisitor = this;