Hi Guys,
I am trying to implement a weight in ruby.
Using
http://stackoverflow.com/questions/549249/polymorphism-across-c-and-ruby-using-swigand
http://xapian.org/docs/sorting.html as bases I came up with this:
class CoordWeight < Xapian::Weight
def initialize
puts "Creating CoordWeight"
super
end
def clone
CoordWeight.new
end
def name
return "CoordWeight"
end
def serialise
return ""
end
def unserialise(un)
CoordWeight.new
end
def get_sumpart(a, b)
return 1
end
def get_maxpart
return 1
end
def get_sumextra(a)
return 0
end
def get_maxextra
return 0
end
def get_sumpart_needs_doclength
return false
end
end
By I get:
"allocator undefined for CoordWeight"
Has anyone manged to do this?
Thanks
On Sat, Sep 12, 2009 at 10:44:49PM +0800, Stuart Hall wrote:> I am trying to implement a weight in ruby.In 1.0, Weight is only subclassable in Python. You could try rebuilding the bindings (you'll need SWIG installed); the code is around line 600 in xapian-bindings/xapian.i -- although whether you'll have any luck I have no idea. In 1.1, this is disabled entirely. I can't find a ticket for this, so I don't know what the current discussion is around this. J -- James Aylett talktorex.co.uk - xapian.org - uncertaintydivision.org