cpoerschke commented on a change in pull request #767:
URL: https://github.com/apache/solr/pull/767#discussion_r837623784



##########
File path: solr/core/src/java/org/apache/solr/highlight/SolrHighlighter.java
##########
@@ -91,13 +87,25 @@ protected boolean emptyArray(String[] arr) {
     return (arr == null || arr.length == 0 || arr[0] == null || 
arr[0].trim().length() == 0);
   }
 
-  private static void expandWildcardsInHighlightFields(
-      Set<String> expandedFields, Collection<String> 
storedHighlightFieldNames, String... fields) {
+  private static String[] expandWildcardsInFields(
+      Supplier<Collection<String>> availableFieldNamesSupplier, String... 
fields) {
+    Set<String> expandedFields = new LinkedHashSet<String>();
+    for (String field : fields) {
+      expandWildcardsInFields(
+          expandedFields, availableFieldNamesSupplier, 
SolrPluginUtils.split(field));
+    }
+    return expandedFields.toArray(new String[] {});
+  }
+
+  private static void expandWildcardsInFields(
+      Set<String> expandedFields,
+      Supplier<Collection<String>> availableFieldNamesSupplier,
+      String... fields) {
     for (String field : fields) {
       if (field.contains("*")) {
         // create a Java regular expression from the wildcard string
         String fieldRegex = field.replaceAll("\\*", ".*");
-        for (String storedFieldName : storedHighlightFieldNames) {
+        for (String storedFieldName : availableFieldNamesSupplier.get()) {

Review comment:
       Yes, if there's more than one wildcard then more than one 
`getDocFetcher().getStoredHighlightFieldNames()` call will now be made but the 
method internally caches e.g. 
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/8.11.1/solr/core/src/java/org/apache/solr/search/SolrDocumentFetcher.java#L182-L204
 i.e. the second and subsequent call would hit the cache.
   
   But let me try and combine the two `expandWildcardsInFields` methods 
actually, they are both private visibility i.e. no signature change 
considerations then and in principle expansion should be do-able with zero or 
one call then.
   
   




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