lib/xapian_db/config.rb in xapian_db-1.2.5 vs lib/xapian_db/config.rb in xapian_db-1.2.5.1
- old
+ new
@@ -51,17 +51,25 @@
def term_min_length
@config.instance_variable_get("@_term_min_length") || 1
end
+ def phrase_search_enabled?
+ @config.instance_variable_get("@_phrase_search_enabled") || false
+ end
+
+ def term_splitter_count
+ @config.instance_variable_get("@_term_splitter_count") || 0
+ end
end
# ---------------------------------------------------------------------------------
# DSL methods
# ---------------------------------------------------------------------------------
- attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_stemmer, :_stopper, :_term_min_length
+ attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_stemmer, :_stopper, :_term_min_length,
+ :_phrase_search_enabled, :_term_splitter_count
# 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)
@@ -141,9 +149,23 @@
# 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
+
+ # Enable phrase search support ("search this exact sentence")
+ def enable_phrase_search
+ @_phrase_search_enabled = true
+ end
+
+ # Disable phrase search support ("search this exact sentence")
+ def disable_phrase_search
+ @_phrase_search_enabled = false
+ end
+
+ def term_splitter_count(count)
+ @_term_splitter_count = count
end
end
end