justinrsweeney commented on code in PR #1996:
URL: https://github.com/apache/solr/pull/1996#discussion_r1358450484


##########
solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java:
##########
@@ -844,4 +844,61 @@ public String getMessage() {
       return "Early Client Disconnect";
     }
   }
+
+  /**
+   * Creates a complete field list using the provided field list by expanding 
any glob patterns into
+   * field names
+   *
+   * @param fields the original set of fields provided
+   * @param searcher an index searcher to access schema info
+   * @return a complete list of fields included any fields matching glob 
patterns
+   * @throws IOException if a provided field does not exist or cannot be 
retrieved from the schema
+   *     info
+   */
+  private List<SchemaField> expandFieldList(String[] fields, SolrIndexSearcher 
searcher)
+      throws IOException {
+    List<SchemaField> expandedFields = new ArrayList<>(fields.length);
+    Set<String> fieldsProcessed = new HashSet<>();
+    for (String field : fields) {
+      try {
+        if (field.contains("*")) {
+          getGlobFields(field, searcher, fieldsProcessed, expandedFields);
+        } else {
+          if (fieldsProcessed.add(field)) {
+            expandedFields.add(searcher.getSchema().getField(field));
+          }
+        }
+      } catch (Exception e) {
+        throw new IOException(e);
+      }
+    }
+
+    return expandedFields;
+  }
+
+  /**
+   * Create a list of schema fields that match a given glob pattern
+   *
+   * @param fieldPattern the glob pattern to match
+   * @param searcher an index search to access schema info
+   * @param fieldsProcessed the set of field names already processed to avoid 
duplicating
+   * @param expandedFields the list of fields to add expanded field names into
+   */
+  private void getGlobFields(
+      String fieldPattern,
+      SolrIndexSearcher searcher,
+      Set<String> fieldsProcessed,
+      List<SchemaField> expandedFields) {
+    for (FieldInfo fi : searcher.getFieldInfos()) {
+      if (GlobPatternUtil.matches(fieldPattern, fi.getName())) {
+        SchemaField schemaField = searcher.getSchema().getField(fi.getName());
+        if (fieldsProcessed.add(fi.getName())
+            && schemaField.hasDocValues()
+            && (!(schemaField.getType() instanceof SortableTextField)

Review Comment:
   I updated this PR to mimic the same behavior as the select handler, where 
`useDocValuesAsStored=false` fields will not be returned unless specifically 
requested. I'm in agreement that consistency here is better.



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