[Xapian-discuss] Ruby Bindings

Stuart Hall stuartkhall at gmail.com
Sat Sep 12 15:44:49 BST 2009


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


More information about the Xapian-discuss mailing list