Awesome that did it! Thanks Andi. I also noticed I wasn't using self in the collect method declaration.
On Wed, Sep 30, 2009 at 12:06 PM, Andi Vajda <va...@apache.org> wrote: > > On Wed, 30 Sep 2009, Max Lynch wrote: > > Hi, I am trying to subclass lucene.PythonHitCollector to use the >> HitCollector features of Lucene, but I get this error: >> >> File "/home/max/test/spider/src/ras/spider/spider.py", line 812, in >> __init__ >> super(lucene.PythonHitCollector, self).__init__() >> lucene.JavaError: java.lang.InstantiationException: >> org.apache.lucene.search.HitCollector >> >> The class I am using: >> >> class MyHitCollector(lucene.PythonHitCollector): >> def __init__(self): >> super(lucene.PythonHitCollector, self).__init__() >> >> def collect(doc, score): >> print "Collecting doc %d" % doc >> return >> >> >> I thought that this would work fine if I used the PythonHitCollector >> instead >> of the HitCollector. Is there something else I need to do? >> > > For an example on how to use PythonHitCollector, see: > samples/LuceneInAction/HitCollectorTest.py > which uses > samples/LuceneInAction/BookLinkCollector.py > a subclass of PythonHitCollector > > It looks like your code is using the wrong class in the super() call in > __init__(). Use MyHitCollector instead. > > Andi.. >