module MongoidXapian::ClassMethods

Public Instance Methods

fti(*args) click to toggle source
# File lib/mongoid-xapian.rb, line 79
def fti(*args)
  # make sure id is not in the list
  args.delete(:id)

  # index mongodb' id
  args << :_id
 
  @xapian_options = args.extract_options!
  @xapian_fields = args
end
search_db(language = "en") click to toggle source
# File lib/mongoid-xapian.rb, line 100
def search_db(language = "en")
  XapianFu::XapianDb.new({
    :dir => self.xapian_db_path(language),
    :create => false,
    :store => @xapian_fields
  })
end
xapian_db(language = "en") click to toggle source
# File lib/mongoid-xapian.rb, line 90
def xapian_db(language = "en")
  @xapian_databases ||= {}

  @xapian_databases[language] ||= XapianFu::XapianDb.new({
    :dir => self.xapian_db_path(language),
    :create => true,
    :store => @xapian_fields
  })
end
xapian_db_path(language = "en") click to toggle source
# File lib/mongoid-xapian.rb, line 108
def xapian_db_path(language = "en")
  "#{Bundler.root}/xapian/#{self.to_s.underscore}.#{language}.db"
end