Skip to content
gernotkogler edited this page Mar 6, 2012 · 1 revision

how to get the xapian document for a model

If you want to get the xapian document belonging to a model, you could implement the following method in your model class:

def xapian_document
  docid       = XapianDb.database.reader.postlist("Q#{xapian_id}").first.docid
  doc         = XapianDb.database.reader.document dicid
  blueprint   = XapianDb::DocumentBlueprint.blueprint_for self.class.name
  doc.extend blueprint.accessors_module
end
Clone this wiki locally