Copilot commented on code in PR #4326:
URL: https://github.com/apache/solr/pull/4326#discussion_r3130348511


##########
solr/modules/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java:
##########
@@ -72,12 +66,9 @@ public void inform(SolrCore core) {}
    */
   @Override
   public void init(NamedList<?> args) {
-    try {
-      loadData();
-    } catch (Exception e) {
-      throw new RuntimeException(
-          "Couldn't load profile data, will return empty languages always!", 
e);
-    }
+    LanguageDetectionSettings settings = 
LanguageDetectionSettings.fromAllIsoCodes639_1().build();
+    orchestrator = LanguageDetectionOrchestrator.fromSettings(settings);
+

Review Comment:
   The previous implementation loaded language profiles once per JVM (static 
loaded flag) because DetectorFactory was global. This change instantiates a new 
LanguageDetectionOrchestrator every time the factory is initialized, which can 
increase core startup time and memory usage when multiple cores use this 
processor. Consider switching to a static/lazy singleton orchestrator (or other 
shared cache) so profiles/settings are built once and reused across factory 
instances (while still honoring any per-core configuration if added later).



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