navneet1v commented on issue #13393:
URL: https://github.com/apache/lucene/issues/13393#issuecomment-2129970534

   @ChrisHegarty 
   
   > The dynamic addition of formats from other class loaders seems reasonable, 
though I don't have a use case for it myself. Maybe I'm missing something 
   
   A use case of this is Opensearch where Opensearch loads the plugins jars 
during runtime, and if they have any classes thats get init using SPI it 
requires a public API to reload the SPI using classloaders. 
   
   
   > is it not possible to implement the functionality through the existing 
Codec and reload ( possibly using FilterCodec ). And/or 
PerFieldKnnVectorsFormat. OR is it a more straightforward way that is being 
suggested?
   
   Actually I implemented this exact same way, where I have my `codec` that 
extends the `FilterCodec`. In that codec I have override the 
`knnVectorsFormat()` function to return a `perFieldKnnVectorsFormat`. This 
`perFieldKnnVectorsFormat` is my own implementation which based on some 
condition either return `Lucene99HnswVectorsFormat` or a new VectorsFormat say 
`NavneetVectorsFormat`. `NavneetVectorsFormat` has its own writer and reader 
classes.
   
   Now during indexing everything works well. But when the IndexReader is 
getting opened, it needs to create an Instance of `NavneetVectorsFormat` using 
SPI. This is where exception start to happen because KNNVectorsFormat SPI 
Holder object doesn't know that `NavneetVectorsFormat` class is present in the 
class path, as the jar where this class was present is loaded during the 
application runtime.
   
   
   I hope this clarifies. 
   


-- 
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...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to