On Tue, 23 Dec 2014, iceout (JIRA) wrote:

I want to override the newTermQuery method of class QueryParser.

There is newTermQuery() method in class QueryParser in Lucene 4.10.x.
Please, specify which version you're verify there is such a method to override in the classic.QueryParser class.

Andi..

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