You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "cpoerschke (via GitHub)" <gi...@apache.org> on 2023/05/12 10:37:31 UTC

[GitHub] [solr] cpoerschke commented on a diff in pull request #1557: SOLR-16677: Updated Solr to use new Lucene 9.5 storedFields() API

cpoerschke commented on code in PR #1557:
URL: https://github.com/apache/solr/pull/1557#discussion_r1192199410


##########
solr/modules/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java:
##########
@@ -166,18 +167,23 @@ public FeatureScorer scorer(LeafReaderContext context) throws IOException {
     public class FieldValueFeatureScorer extends FeatureScorer {
 
       LeafReaderContext context = null;
+      StoredFields storedFields = null;

Review Comment:
   Wondering if this could be private and/or final (even though `context` isn't currently)?
   ```suggestion
         private final StoredFields storedFields;
   ```



##########
solr/core/src/java/org/apache/solr/handler/admin/IndexSizeEstimator.java:
##########
@@ -384,16 +386,17 @@ private void estimateTermVectors(Map<String, Object> result) throws IOException
     for (LeafReaderContext leafReaderContext : reader.leaves()) {
       LeafReader leafReader = leafReaderContext.reader();
       Bits liveDocs = leafReader.getLiveDocs();
+      TermVectors termVectors = leafReader.termVectors();
       for (int docId = 0; docId < leafReader.maxDoc(); docId += samplingStep) {
         if (liveDocs != null && !liveDocs.get(docId)) {
           continue;
         }
-        Fields termVectors = leafReader.getTermVectors(docId);
-        if (termVectors == null) {
+        Fields vectors = termVectors.get(docId);
+        if (vectors == null) {

Review Comment:
   > Why change the variable name? "vectors" is becoming a more ambiguous word in recent times ("vector search")
   
   I guess it allows the `termVectors` name to be used above where it matches the type and retrieval method name.
   
   How about `fields` as the changed variable name instead of `vectors`?



##########
solr/core/src/java/org/apache/solr/handler/component/TermVectorComponent.java:
##########
@@ -251,6 +252,7 @@ public void process(ResponseBuilder rb) throws IOException {
     SolrIndexSearcher searcher = rb.req.getSearcher();
 
     IndexReader reader = searcher.getIndexReader();
+    TermVectors tm = reader.termVectors();

Review Comment:
   > Please improve this variable name, such as use `termVectors`
   
   There's a `NamedList<Object> termVectors` above already. Maybe that one could be renamed to `nlTermVectors` or `termVectorsNl` or something and then the `tm` here could become `termVectors`?



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org