On Mon, 27 Sep 2010, Bill Janssen wrote:

Here's a printout of what I'm seeing:

 UpLibQueryParser.parse('_query_language:nl janssen')...
 => lucene.VERSION: 3.0.2 , jcc._jcc.JCC_VERSION 2.6
 => Exception received is JavaError(<Throwable: org.apache.jcc.PythonException: 
Query specifies language 'nl'
 Traceback (most recent call last):
   File "/u/python/uplib/indexing.py", line 591, in getFieldQuery
     raise RequiresQueryLanguage(text)
 __main__.RequiresQueryLanguage: Query specifies language 'nl'
 >,)

You are using --shared because the exception you're getting is PythonException.

Is there some way to check to see if lucene is using --shared at runtime?

No direct way that I can think of at the moment.

So, it looks like you're getting a JavaError that wraps a PythonException.
Yet it's wrapped by a JavaError. This could mean that the test that checks if the PythonException instance is of class PythonException line 426 in JCCEnv.cpp is failing.

As a hack, try changing that line to do a string compare on the class names instead. Or just force it to true, even.

If that solves the problem, then you have an issue where this class, PythonException is loaded multiple times. You might want to consider using the new --import flag with --shared to better share common classes between your modules. That being said, PythonException comes from the JCC runtime itself, so it shouldn't be duplicated that way but I've been fooled by class loaders before.

Andi..

The actual exception class I'm raising:

 class RequiresQueryLanguage (Exception):

     def __init__(self, msg):
         Exception.__init__(self, "Query specifies language '%s'" % msg)
         self.language = msg

from this code segment:

           elif (fieldname == "_query_language"):
               if not _check_analyzer(self.getAnalyzer(), fieldtext):
                   raise RequiresQueryLanguage(fieldtext)
               else:
                   # we want to remove it if the condition is satisfied
                   return None

Bill

Reply via email to