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


##########
solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java:
##########
@@ -316,6 +318,7 @@ private static SimpleOrderedMap<Object> 
getDocumentFieldsInfo(
       Document doc, int docId, IndexReader reader, IndexSchema schema) throws 
IOException {
     final CharsRefBuilder spare = new CharsRefBuilder();
     SimpleOrderedMap<Object> finfo = new SimpleOrderedMap<>();
+    TermVectors termVectors = reader.termVectors();

Review Comment:
   1/2 Could potentially lazily initialise e.g.
   
   ```suggestion
       TermVectors termVectors = null;
   ```



##########
solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java:
##########
@@ -353,7 +356,7 @@ private static SimpleOrderedMap<Object> 
getDocumentFieldsInfo(
       // If we have a term vector, return that
       if (field.fieldType().storeTermVectors()) {
         try {
-          Terms v = reader.getTermVector(docId, field.name());
+          Terms v = termVectors.get(docId, field.name());

Review Comment:
   2/2 ... lazy init before use
   ```suggestion
             if (termVectors == null) termVectors = reader.termVectors();
             Terms v = termVectors.get(docId, field.name());
   ```



##########
solr/core/src/java/org/apache/solr/search/SolrDocumentFetcher.java:
##########
@@ -372,7 +372,7 @@ public void doc(int docId, StoredFieldVisitor visitor) 
throws IOException {
       Document cached = doc(docId);
       visitFromCached(cached, visitor);
     } else {
-      searcher.getIndexReader().document(docId, visitor);
+      searcher.getIndexReader().storedFields().document(docId, visitor);

Review Comment:
   > ... a more elegant solution isn't obvious but we should do something. ...
   
   Wondering what the next steps here might be e.g. is it a blocker for this 
PR, or would we wish to create a JIRA for some `SolrDocumentFetcher` changes to 
happen first, or something else?



##########
solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java:
##########
@@ -570,7 +571,8 @@ protected void flatten(
       fieldHighlights =
           doHighlightingByFastVectorHighlighter(doc, docId, schemaField, 
fvhContainer, reader, req);
     } else { // standard/default highlighter
-      fieldHighlights = doHighlightingByHighlighter(doc, docId, schemaField, 
query, reader, req);
+      fieldHighlights =
+          doHighlightingByHighlighter(doc, docId, schemaField, query, 
reader.termVectors(), req);

Review Comment:
   `reader.termVectors()` is called in a loop here, I'll push a commit to try 
and replace that.



-- 
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-unsubscr...@solr.apache.org

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


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

Reply via email to