Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-16203: Initialize schema plugins loaded by SPI name #2175

Merged
merged 4 commits into from
Jan 5, 2024

Conversation

janhoy
Copy link
Contributor

@janhoy janhoy commented Jan 3, 2024

@janhoy
Copy link
Contributor Author

janhoy commented Jan 3, 2024

First attempt in efadf94:

Naïve solution, explicitly calling inform() in FieldTypePluginLoader. The two tests from JIRA are added to this PR to demonstrate.

There may be a more elegant place to do the init. We risk double inform if not using SPI since we don't check that here. Perhaps there is some method somewhere that could be called on the entire chain instead of in each init(), such as the one in ManagedIndexSchema#informResourceLoaderAwareObjectsInChain(). I did not dive deep here. Open to suggestions from folks who know the code better.

@janhoy
Copy link
Contributor Author

janhoy commented Jan 3, 2024

Second attempt:

The first attempt did not work for packages, since FieldTypePluginLoader#init was too early in the cycle to initialize analyzers from packages.

Managed schema handled the missing inform call after SPI already, so moved the method informResourceLoaderAwareObjectsForFieldType from ManagedIndexSchema to IndexSchema and use it at the end of IndexSchema#readSchema. All tests pass.

@janhoy
Copy link
Contributor Author

janhoy commented Jan 5, 2024

Thanks for nice proposals @uschindler , the method is now private and code cleaner

@janhoy janhoy merged commit 8201bf8 into apache:main Jan 5, 2024
2 checks passed
janhoy added a commit that referenced this pull request Jan 5, 2024
janhoy added a commit to janhoy/solr that referenced this pull request Jan 5, 2024
janhoy added a commit that referenced this pull request Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants