[Xapian-discuss] Can not use custom weight scheme with python binding

piglei piglei2007 at gmail.com
Tue Jul 17 10:26:49 BST 2012


Hi, I'm trying to use custom weight with python binding.
My test code is like this.

class TinkerWeight(xapian.Weight):
    def __init__(self):
        pass

    def name(self):
        return "Tinker"

    def serialize(self):
        return ""

    def get_sumpart(*args):
        return 1

    def get_maxpart(*args):
        return 1

    def get_sumextra(*args):
        return 0

    def get_maxextra(*args):
        return 0

... ...

enquire.set_weighting_scheme(TinkerWeight())

But is throws this error:
*in method 'Enquire_set_weighting_scheme', argument 2 of type
'Xapian::Weight const &'*

Could anyone help me to solve this? Thanks a lot.


More information about the Xapian-discuss mailing list