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/22 12:56:09 UTC

(solr) branch jira/solr-13350 updated (21656ee8dbb -> 026395805af)

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 21656ee8dbb factor out SearchResult.getDocSet method
     new 7219a1e5a59 factor out SearchResult.getTopDocsResult method
     new 026395805af mark SolrIndexSearcher.SearchResult.result Object[] private

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  | 26 +++++++++++++---------
 1 file changed, 16 insertions(+), 10 deletions(-)


(solr) 02/02: mark SolrIndexSearcher.SearchResult.result Object[] private

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 026395805af657ad9e27beea2589e81f4313f920
Author: Christine Poerschke <cp...@apache.org>
AuthorDate: Thu Feb 22 12:53:56 2024 +0000

    mark SolrIndexSearcher.SearchResult.result Object[] private
---
 solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 aa83202b483..bd78a7b8789 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
@@ -2158,8 +2158,8 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
   }
 
   static class SearchResult {
-    final Object[] result;
     final ScoreMode scoreMode;
+    private final Object[] result;
 
     public SearchResult(ScoreMode scoreMode, Object[] result) {
       this.scoreMode = scoreMode;


(solr) 01/02: factor out SearchResult.getTopDocsResult method

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 7219a1e5a59c62ebf3df0035314b2746c4ad60d8
Author: Christine Poerschke <cp...@apache.org>
AuthorDate: Thu Feb 22 12:49:55 2024 +0000

    factor out SearchResult.getTopDocsResult method
---
 .../org/apache/solr/search/SolrIndexSearcher.java  | 24 ++++++++++++++--------
 1 file changed, 15 insertions(+), 9 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 de0eef98db5..aa83202b483 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
@@ -1934,11 +1934,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
             searchCollectorManagers(len, cmd, query, true, needScores, false);
         scoreModeUsed = searchResult.scoreMode;
 
-        final Object[] res = searchResult.result;
-        final TopDocsResult result = (TopDocsResult) res[0];
-
-        totalHits = result.totalHits;
-        topDocs = result.topDocs;
+        TopDocsResult topDocsResult = searchResult.getTopDocsResult();
+        totalHits = topDocsResult.totalHits;
+        topDocs = topDocsResult.topDocs;
 
         maxScore = searchResult.getMaxScore(totalHits);
       }
@@ -2168,6 +2166,15 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
       this.result = result;
     }
 
+    public TopDocsResult getTopDocsResult() {
+      for (Object res : result) {
+        if (res instanceof TopDocsResult) {
+          return (TopDocsResult) res;
+        }
+      }
+      return null;
+    }
+
     public float getMaxScore(int totalHits) {
       if (totalHits > 0) {
         for (Object res : result) {
@@ -2293,10 +2300,9 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
         boolean needMaxScore = needScores;
         SearchResult searchResult =
             searchCollectorManagers(len, cmd, query, true, needMaxScore, true);
-        Object[] res = searchResult.result;
-        TopDocsResult result = (TopDocsResult) res[0];
-        totalHits = result.totalHits;
-        topDocs = result.topDocs;
+        TopDocsResult topDocsResult = searchResult.getTopDocsResult();
+        totalHits = topDocsResult.totalHits;
+        topDocs = topDocsResult.topDocs;
         maxScore = searchResult.getMaxScore(totalHits);
         set = searchResult.getDocSet();