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



##########
File path: solr/core/src/java/org/apache/solr/highlight/SolrHighlighter.java
##########
@@ -88,32 +88,28 @@ protected boolean emptyArray(String[] arr) {
   }
 
   private static String[] expandWildcardsInFields(
-      Supplier<Collection<String>> availableFieldNamesSupplier, String... 
fields) {
+      Supplier<Collection<String>> availableFieldNamesSupplier, String... 
inFields) {
     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 : availableFieldNamesSupplier.get()) {
-          if (storedFieldName.matches(fieldRegex)) {
-            expandedFields.add(storedFieldName);
+    Collection<String> availableFieldNames = null;
+    for (String inField : inFields) {
+      for (String field : SolrPluginUtils.split(inField)) {
+        if (field.contains("*")) {
+          // create a Java regular expression from the wildcard string
+          String fieldRegex = field.replaceAll("\\*", ".*");

Review comment:
       > I realize it was like this before but it'd be awesome if you could 
extract a Pattern here to be re-used across looping the fields instead of 
letting Java's convenient API methods internally recompute the automata 
internally each time.
   
   #778 explores forbidding `String.matches(String)` in the code base, in 
favour of compiled patterns.




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