class ThinkingSphinx::Panes::ExcerptsPane

Public Class Methods

new(context, object, raw) click to toggle source
# File lib/thinking_sphinx/panes/excerpts_pane.rb, line 4
def initialize(context, object, raw)
  @context, @object = context, object
end

Public Instance Methods

excerpts() click to toggle source
# File lib/thinking_sphinx/panes/excerpts_pane.rb, line 8
def excerpts
  @excerpt_glazing ||= Excerpts.new @object, excerpter
end

Private Instance Methods

excerpt_words() click to toggle source
# File lib/thinking_sphinx/panes/excerpts_pane.rb, line 22
def excerpt_words
  @excerpt_words ||= begin
    conditions = @context.search.options[:conditions] || {}
    ThinkingSphinx::Search::Query.new(
      ([@context.search.query] + conditions.values).compact.join(' '),
      {}, @context.search.options[:star]
    ).to_s
  end
end
excerpter() click to toggle source
# File lib/thinking_sphinx/panes/excerpts_pane.rb, line 14
def excerpter
  @excerpter ||= ThinkingSphinx::Excerpter.new(
    @context[:indices].first.name,
    excerpt_words,
    @context.search.options[:excerpts] || {}
  )
end