# File lib/sup/index.rb, line 216 def self.init type=nil ## determine the index type from the many possible ways of setting it type = (type == "auto" ? nil : type) || ENV['SUP_INDEX'] || $config[:index] || (File.exist?(File.join(BASE_DIR, "xapian")) && "xapian") || ## PRIORITIZE THIS (File.exist?(File.join(BASE_DIR, "ferret")) && "ferret") || ## deprioritize this DEFAULT_NEW_INDEX_TYPE begin require "sup/#{type}_index" @klass = Redwood.const_get "#{type.capitalize}Index" @obj = @klass.init rescue LoadError, NameError => e raise "unknown index type #{type.inspect}: #{e.message}" end debug "using #{type} index" @obj end