mocobeta edited a comment on pull request #567:
URL: https://github.com/apache/lucene/pull/567#issuecomment-1003258524


   > There are some remaining issues with code doing: 
Class.getClassLoader().getResource.... This code does not even work from inside 
the same module and always returns null. In most cases this is just a bug: From 
what I see it only affects BinaryDictionary in Kuromoji and Nori. As said 
before this should be refactored to not have this crazy File vs. Resource 
options from former times not applicable to Lucene anymore.
   
   There are two problems and I think we can handle them separately.
   
   As for the first one, "Class.getClassLoader().getResource....", all 
resources (dictionary data) contained in kuromoji and nori are placed in 
"org/apache/lucene/analysis/[ja|ko]/dict/", so they can be loaded by 
`org.apache.lucene.analysis.[ja|ko].dict.BinaryDictionary.class#getResourceAsStream()`
 by tweaking the paths a bit.
   A quick fix is here and it passes tests. I can make a PR or directly commit 
it into this branch, if you are okay with that.
   
https://github.com/mocobeta/lucene/commit/5432b09c980f029d03c6271b3ab7f50d0a9842e7
   
   As for the second one, "File vs. Resource options", resolving this is not 
much trivial to me. I think another issue is needed for it.
   I am sure we can deprecate `protected BinaryDictionary(ResourceScheme 
resourceScheme, String resourcePath)` and break it down into two constructors - 
one for resources from the class-path (no-arg constructor), another for 
external resources from the user's file system.


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