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 11:38:24 UTC
(solr) branch jira/solr-13350 updated: factor out SearchResult.getDocSet method
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
The following commit(s) were added to refs/heads/jira/solr-13350 by this push:
new 21656ee8dbb factor out SearchResult.getDocSet method
21656ee8dbb is described below
commit 21656ee8dbbcef215117f18cb7d789837c0522f5
Author: Christine Poerschke <cp...@apache.org>
AuthorDate: Thu Feb 22 11:15:55 2024 +0000
factor out SearchResult.getDocSet method
---
.../org/apache/solr/search/SolrIndexSearcher.java | 23 +++++++++++-----------
1 file changed, 11 insertions(+), 12 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 8e212ea7b4a..de0eef98db5 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
@@ -2180,6 +2180,15 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
return 0.0f;
}
}
+
+ public DocSet getDocSet() {
+ for (Object res : result) {
+ if (res instanceof DocSetResult) {
+ return ((DocSetResult) res).docSet;
+ }
+ }
+ return null;
+ }
}
// any DocSet returned is for the query only, without any filtering... that way it may
@@ -2194,7 +2203,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
final float maxScore;
final int[] ids;
final float[] scores;
- DocSet set = null;
+ final DocSet set;
final boolean needScores = (cmd.getFlags() & GET_SCORES) != 0;
final int maxDoc = maxDoc();
@@ -2289,17 +2298,7 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
totalHits = result.totalHits;
topDocs = result.topDocs;
maxScore = searchResult.getMaxScore(totalHits);
- if (needMaxScore) {
- if (res.length > 2) {
- DocSetResult result3 = (DocSetResult) res[2];
- set = result3.docSet;
- }
- } else {
- if (res.length > 1) {
- DocSetResult result2 = (DocSetResult) res[1];
- set = result2.docSet;
- }
- }
+ set = searchResult.getDocSet();
// TODO: Is this correct?
// hitsRelation = populateScoresIfNeeded(cmd, needScores, topDocs, query,