On Jul 9, 2010, at 9:53 AM, Soby Thomas wrote:
> Hi ,
> 
> I'm trying to use MultiFieldQueryParser. But it is giving me an error. This
> is the code which I wrote for it.
> 
> * query = lucene.MultiFieldQueryParser(lucene.Version.LUCENE_CURRENT,
> ["payload","subject"], analyzer).parse(command)

I think there's a bug with the method binding.  MultiFieldQueryParser has 
several static parse methods, plus the inherited regular method from 
QueryParser.  It looks like all of them are being resolved as if they were 
static.  As a workaround, you can call it like this:

parser = lucene.MultiFieldQueryParser(lucene.Version.LUCENE_CURRENT, 
["payload","subject"], analyzer)
lucene.MultiFieldQueryParser.parse(parser, command)

> *The error 'm getting is this...
> 
> *Traceback (most recent call last):
>  File "SearchFiles.py", line 37, in <module>
>    run(searcher, analyzer)
>  File "SearchFiles.py", line 19, in run
>    query = lucene.MultiFieldQueryParser(lucene.Version.LUCENE_CURRENT,
> ["payload","subject"], analyzer).parse(command)
> TypeError: descriptor 'parse' requires a 'QueryParser' object but received a
> 'str'
> 
> 
> *It would be helpful if the solution is given by an example.
> 
> Thanks

Reply via email to