HoustonPutman commented on code in PR #3222:
URL: https://github.com/apache/solr/pull/3222#discussion_r1983473324


##########
solr/core/src/java/org/apache/solr/search/DocIterator.java:
##########
@@ -43,4 +43,13 @@ public interface DocIterator extends Iterator<Integer> {
    * instance was retrieved.
    */
   public float score();
+
+  /**
+   * Returns the query match score in case of rerank queries
+   *
+   * @return the query match score in case of a rerank query, null otherwise.
+   */
+  public default Float matchScore() {
+    return null;
+  }

Review Comment:
   Much like `score()` we might want to keep this as a `float` and return 0. 
Not really leaning either way on this yet.



##########
solr/core/src/java/org/apache/solr/search/DocSlice.java:
##########


Review Comment:
   For this, would it make more sense to have another implementation of 
DocSlice for a TopDocs? It looks like every method has an if statement in it. 
Might be more efficient to go with two implementations.



##########
solr/solr-ref-guide/modules/query-guide/pages/query-re-ranking.adoc:
##########
@@ -107,6 +107,9 @@ q=greetings&rq={!rerank reRankQuery=$rqq reRankDocs=1000 
reRankWeight=3}&rqq=(hi
 ----
 
 If a document matches the original query, but does not match the re-ranking 
query, the document's original score will remain.
+For reranked documents, an additional _matchScore_ field in the response will 
indicate the original score for a reranked doc. This
+is the score for the document prior to rerank being applied. For documents 
that were not reranked, the matchScore and score fields
+will have the same value.

Review Comment:
   ```suggestion
   For reranked documents, an additional `matchScore` field in the response 
will indicate the original score for a reranked doc. This
   is the score for the document prior to rerank being applied. For documents 
that were not reranked, the matchScore and score fields
   will have the same value. For the example above, you would use the following 
to return the match score:
   
   [source,text]
   ----
   q=greetings&rq={!rerank reRankQuery=$rqq reRankDocs=1000 
reRankWeight=3}&rqq=(hi+hello+hey+hiya)&fl=id,matchScore
   ----
   ```



##########
solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java:
##########


Review Comment:
   This in general looks fine to me, but I am not an expert here and would love 
another set of eyes.



##########
solr/core/src/java/org/apache/solr/search/ReRankCollector.java:
##########
@@ -205,18 +205,29 @@ public TopDocs topDocs(int start, int howMany) {
         ScoreDoc[] scoreDocs = new ScoreDoc[howMany];
         System.arraycopy(rescoredDocs.scoreDocs, 0, scoreDocs, 0, howMany);
         rescoredDocs.scoreDocs = scoreDocs;
-        return rescoredDocs;
       }
+      return toRescoredDocs(rescoredDocs, docToOriginalScore);

Review Comment:
   Don't we only want to do this if the user has asked for it?



##########
solr/core/src/test/org/apache/solr/search/TestReRankQParserPlugin.java:
##########
@@ -64,6 +64,80 @@ public void testReRankQParserPluginConstants() {
     assertEquals(ReRankQParserPlugin.RERANK_OPERATOR, "reRankOperator");
   }
 
+  @Test
+  public void testRerankReturnOriginalScore() throws Exception {

Review Comment:
   This should be MatchScore not OriginalScore, right?
   
   Also can we test returning the MatchScore for a non-reranked query? You 
mentioned that in the ref-guide update.



##########
solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java:
##########
@@ -194,7 +193,6 @@ public class SolrIndexSearcher extends IndexSearcher 
implements Closeable, SolrI
 
   private final StatsCache statsCache;
 
-  private Set<String> metricNames = ConcurrentHashMap.newKeySet();

Review Comment:
   Also this?



##########
solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java:
##########
@@ -183,7 +182,7 @@ public class SolrIndexSearcher extends IndexSearcher 
implements Closeable, SolrI
   @SuppressWarnings({"rawtypes"})
   private final SolrCache[] cacheList;
 
-  private DirectoryFactory directoryFactory;
+  private final DirectoryFactory directoryFactory;

Review Comment:
   Why did you change this?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to