kotman12 commented on code in PR #4053:
URL: https://github.com/apache/solr/pull/4053#discussion_r2710008273


##########
solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java:
##########
@@ -484,43 +488,75 @@ void writeDoc(
     LeafReaderContext context = leaves.get(ord);
     int fieldIndex = 0;
     for (FieldWriter fieldWriter : writers) {
-      if (fieldWriter.write(sortDoc, context, ew, fieldIndex)) {
-        ++fieldIndex;
-      }
+      fieldIndex += fieldWriter.write(sortDoc, context, ew, fieldIndex);
     }
   }
 
   public List<FieldWriter> getFieldWriters(String[] fields, SolrQueryRequest 
req)
       throws IOException {
     DocValuesIteratorCache dvIterCache = new 
DocValuesIteratorCache(req.getSearcher(), false);
-
     SolrReturnFields solrReturnFields = new SolrReturnFields(fields, req);
+    boolean includeStoredFields = 
req.getParams().getBool(INCLUDE_STORED_FIELDS_PARAM, false);
 
     List<FieldWriter> writers = new ArrayList<>();
+    Set<SchemaField> docValueFields = new LinkedHashSet<>();
+    Map<String, SchemaField> storedFields = new LinkedHashMap<>();
+
     for (String field : req.getSearcher().getFieldNames()) {
       if (!solrReturnFields.wantsField(field)) {
         continue;
       }
       SchemaField schemaField = req.getSchema().getField(field);
-      if (!schemaField.hasDocValues()) {
-        throw new IOException(schemaField + " must have DocValues to use this 
feature.");
-      }
-      boolean multiValued = schemaField.multiValued();
       FieldType fieldType = schemaField.getType();
-      FieldWriter writer;
 
-      if (fieldType instanceof SortableTextField && 
!schemaField.useDocValuesAsStored()) {
-        if (solrReturnFields.getRequestedFieldNames() != null
-            && solrReturnFields.getRequestedFieldNames().contains(field)) {
-          // Explicitly requested field cannot be used due to not having 
useDocValuesAsStored=true,
-          // throw exception
+      // Check if field can use DocValues
+      boolean canUseDocValues =
+          schemaField.hasDocValues()
+              && (!(fieldType instanceof SortableTextField) || 
schemaField.useDocValuesAsStored());

Review Comment:
   The reason is for `/export` it was decided that you don't need an explicit 
`udvas` for "cheap" fields I guess (so anything that is _not_ a text field)? 
Idk, I am trying to follow this 
[thread](https://github.com/apache/solr/pull/1996#discussion_r1355153153).
   
   Edit: could also be a backwards compat thing since this udvas requirement 
wasn't there for the other fields and then when `SortableTextField` was added 
it was decided to handle it a more correct way.



-- 
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