You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by "iceout (JIRA)" <ji...@apache.org> on 2014/12/23 11:31:13 UTC

[jira] [Created] (PYLUCENE-33) Cannot override newTermQuery method of class QueryParser

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)

Re: [jira] [Created] (PYLUCENE-33) Cannot override newTermQuery method of class QueryParser

Posted by Andi Vajda <va...@apache.org>.
On Tue, 23 Dec 2014, Andi Vajda wrote:

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

Sorry, I meant to say that there is _no_ newTermQuery() method on that 
class.

Andi..

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

Re: [jira] [Created] (PYLUCENE-33) Cannot override newTermQuery method of class QueryParser

Posted by Andi Vajda <va...@apache.org>.
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)
>