[pylucene-dev] ConstantScoreQuery

tsuraan at tsuraan.net tsuraan at tsuraan.net
Thu Aug 23 08:19:38 PDT 2007


Is it possible to create a ConstantScoreQuery using a python-defined 
filter?  I'm trying the following, and I get the pasted error:

 >>> class MyFilter(object):
...  def bits(self, reader):
...   return BitSet()
...
 >>> f=MyFilter()
 >>> q=ConstantScoreQuery(f)
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
pybackend.thirdparty.PyLucene.lnxpyd.PyLucene.InvalidArgsError: (<type 
'PyLucene.ConstantScoreQuery'>, '__init__', (<__main__.MyFilter object 
at 0xb7cda14c>,))


So, my other thought was maybe I need to inherit from the PyLucene 
Filter object, but that doesn't work either:

 >>> class MyFilter(Filter):
...  def bits(self, reader):
...   return BitSet()
...
 >>> f=MyFilter()
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
pybackend.thirdparty.PyLucene.lnxpyd.PyLucene.InvalidArgsError: (<class 
'__main__.MyFilter'>, '__init__', ())


So, am I missing something, or is ConstantScoreQuery currently only 
capable of using built-in filters?

I'm using PyLucene 2.1.0-1 on Gentoo Linux with gcc 4.1.2; all tests 
and sample code works for me.



More information about the pylucene-dev mailing list