iceout created PYLUCENE-33:
------------------------------

             Summary: Cannot override newTermQuery method of class QueryParser
                 Key: PYLUCENE-33
                 URL: https://issues.apache.org/jira/browse/PYLUCENE-33
             Project: PyLucene
          Issue Type: Bug
         Environment: ubuntu 12.04, python 2.7
            Reporter: iceout


I want to override the newTermQuery method of class QueryParser.

First, I add the following code in 
org/apache/pylucene/queryparser/classic/PythonQueryParser.java.

    protected native Query newTermQuery(Term term);

But it said:

    lucene.JavaError: 
org.apache.jcc.PythonException:java.lang.UnsatisfiedLinkError: 
org.apache.pylucene.queryparser.classic.PythonQueryParser.newTermQuery

Then I changed the code:

    public native Query newTermQuery(Term term);

But there still is a Exception:

    lucene.JavaError: org.apache.jcc.PythonException: 
org.apache.jcc.PythonException: (<type 'PayloadTermQuery'>, '__init__', (<Term: 
body:fox>, <type 'AveragePayloadFunction'>))

My python is:

    class PayloadQueryParser(PythonQueryParser):

        def __init__(self, matchVersion, f, a):
            super(PayloadQueryParser, self).__init__(matchVersion, f, a)

        def getFieldQuery_quoted(self, field, queryText, quoted):
            return super(PayloadQueryParser, 
self).getFieldQuery_quoted_super(field, queryText, quoted)

        def newTermQuery(self, term):
            return PayloadTermQuery(term, AveragePayloadFunction)
 
    



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to