lib/xapian_db/config.rb in xapian_db-1.2.4.7 vs lib/xapian_db/config.rb in xapian_db-1.2.5

- old
+ new

@@ -46,17 +46,22 @@ end def resque_queue @config.instance_variable_get("@_resque_queue") || 'xapian_db' end + + def term_min_length + @config.instance_variable_get("@_term_min_length") || 1 + end + end # --------------------------------------------------------------------------------- # DSL methods # --------------------------------------------------------------------------------- - attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_stemmer, :_stopper + attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_stemmer, :_stopper, :_term_min_length # Set the global database to use # @param [String] path The path to the database. Either apply a file sytem path or :memory # for an in memory database def database(path) @@ -132,8 +137,13 @@ lang ||= :none @_stemmer = XapianDb::Repositories::Stemmer.stemmer_for lang @_stopper = lang == :none ? nil : XapianDb::Repositories::Stopper.stopper_for(lang) end + # Set minimum length a term must have to get indexed; 2 is a good value to start + # @param [Integer] length The minimum length + def term_min_length(length) + @_term_min_length = length + end end end