lib/thinking_sphinx/raspell.rb in thinking-sphinx-raspell-1.0.0 vs lib/thinking_sphinx/raspell.rb in thinking-sphinx-raspell-1.1.0
- old
+ new
@@ -1,6 +1,7 @@
require 'raspell'
+require 'thinking_sphinx/raspell/configuration'
module ThinkingSphinx
# Module for adding suggestion support into Thinking Sphinx. This gets
# included into ThinkingSphinx::Search.
#
@@ -54,22 +55,15 @@
#
def corrected_word(word)
speller.check(word) ? word : speller.suggest(word).first
end
- # Aspell instance with all appropriate settings defined (dictionary set to
- # en_US, suggestion mode set to Aspell::NORMAL, and ignore-case set to
- # true).
+ # Aspell instance with all appropriate settings defined.
#
# @return [Aspell] the prepared Aspell instance
#
def speller
- @speller ||= begin
- speller = Aspell.new('en_US')
- speller.suggestion_mode = Aspell::NORMAL
- speller.set_option "ignore-case", "true"
- speller
- end
+ ThinkingSphinx::Configuration.instance.raspell.speller
end
end
end
ThinkingSphinx::Search.send(:include, ThinkingSphinx::Raspell)