You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Stéphane Campinas <st...@deri.org> on 2011/09/08 20:01:14 UTC
Solr and internationalization
Hi,
I am working on a plugin for Solr, and in this project, a
QueryNodeException [1] is thrown in the case of an error while parsing
the query.
However, I receive the following exception in such a case:
HTTP Status 500 - Can't find bundle for base name
org.apache.lucene.queryParser.core.messages.QueryParserMessages,
locale en_IE java.util.MissingResourceException: Can't find bundle
for base name
org.apache.lucene.queryParser.core.messages.QueryParserMessages,
locale en_IE at
java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1427)
.....
It seems that this is because my solr app cannot find a ressource bundle
while writing the exception message. Lucene supports
internationalization in query's exception messages thanks to the NLS [2]
class.
It should search for terms in the default property file
*org/apache/lucene/queryParser/core/messages/QueryParserMessages.properties*,
which is set in [1], in the case of the property file in the current
locale missing, in my case "en_IE".
Creating the file with the current local, i.e.,
org/apache/lucene/queryParser/core/messages/QueryParserMessages*_en_IE*.properties,
and putting it into a jar placed in the lib folder of my solr app
changed nothing.
Would you know why the default property file is not seen ? What would be
the required steps to add internationalization support in Solr ? Or, at
least, to remove the "bundle" exception ?
Regards,
[1]
http://lucene.apache.org/java/3_1_0/api/contrib-queryparser/org/apache/lucene/queryParser/core/QueryNodeException.html
[2]
http://lucene.apache.org/java/3_1_0/api/core/org/apache/lucene/messages/NLS.html
--
Campinas Stéphane
Re: Solr and internationalization
Posted by Chris Hostetter <ho...@fucit.org>.
: It seems that this is because my solr app cannot find a ressource bundle while
: writing the exception message. Lucene supports internationalization in query's
: exception messages thanks to the NLS [2] class.
...
: Creating the file with the current local, i.e.,
: org/apache/lucene/queryParser/core/messages/QueryParserMessages*_en_IE*.properties,
: and putting it into a jar placed in the lib folder of my solr app changed
: nothing.
I suspect this is a classloader problem -- i haven't looked at the code
for the QueryParser you're using, but more then likely it's asking *it's*
classloader to find the file, and if thta's not the same classloader as
where the properties file is located, there may be problems.
where are you putting the contrib-queryparser jar in your setup? where are
you putting the properties file? where are you putting your custom solr
plugin that uses the contrib-queryparser code?
-Hoss