# File lib/thinking_sphinx/excerpter.rb, line 10 def initialize(index, words, options = {}) @index, @words = index, words @options = DefaultOptions.merge(options) @words = @options.delete(:words) if @options[:words] end
# File lib/thinking_sphinx/excerpter.rb, line 16 def excerpt!(text) result = ThinkingSphinx::Connection.take do |connection| connection.query(statement_for(text)).first['snippet'] end ThinkingSphinx::Configuration.instance.settings['utf8'] ? result : ThinkingSphinx::UTF8.encode(result) end
# File lib/thinking_sphinx/excerpter.rb, line 27 def statement_for(text) Riddle::Query.snippets(text, index, words, options) end