I am using the latest Sphinx and ThinkingSphinx, and comparing it with my 
memory of a much older setup (I don't have the older system in place any more). 
Searching within a single title (these are large books) for a word which I know 
appears dozens of times, I only get back two excerpts. I could swear that the 
previous setup returned all of them. At this level of search, I am not 
concerned with finding the fact that the term appears at all, but rather to 
find how many times total it appears. Is there a lever I can pull to control 
this behavior? I will admit to having put a few values in the search settings 
somewhat blindly, trying to get this to work, so I may have messed things up 
here.

Here's what the controller looks like for "Search within this title":

  def title
    @title = Title.find(params[:title_id])
    @results = Title.search 
"\"#{ThinkingSphinx::Query.escape(params[:q].to_s)}\"",
    :with => {:title_id => Array(@title.id)},
    :page => params[:page],
    :star => true,
    :excerpts => {
      :limit    => 1000,
      :around     => 40,
      :force_all_words => true,
      :chunk_separator => '</li><li>'
    } rescue Kaminari::paginate_array []
    @results.context[:panes] << ThinkingSphinx::Panes::ExcerptsPane
    @hits = 
"<li>#{@results.first.excerpts.plain_contents}</li>".gsub(/<li>\s*<\/li>/,'').split('</li><li>').length
 rescue 0
    render :template => 'search/set'
  end


And here's the index for titles:

ThinkingSphinx::Index.define :title, :with => :active_record do
  set_property :group_concat_max_len => 10.megabytes

  indexes :title, :sortable => true
  indexes teaser
  indexes content.plain, :as => :plain_text
  indexes author_name, :sortable => true
  has roles(:person_id), :as => :people_ids 
  has :id, :as => :title_id
  has author_id, created_at, updated_at
  has set, :as => :title_set
  where sanitize_sql(["publish", true])
end

Thanks in advance for any suggestions.

Walter

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to