Douglas Tan
unread,Jul 20, 2011, 5:59:57 AM7/20/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to thinkin...@googlegroups.com
Hi list,
I'm getting the error below when fetching result excerpts from another index defined on a model:
Loading development environment (Rails 2.3.8)
ruby-1.8.7-p334 :001 > r = ThinkingSphinx.search('banner', :index => 'published_with_publication_period')
=> [#<Page id: 25, title: "Prizes", slug: "prizes", breadcrumb: "Prizes", class_name: nil, status_id: 100, parent_id: 4, layout_id: nil, created_at: "2011-07-14 13:57:31", updated_at: "2011-07-20 09:27:38", published_at: "2011-07-13 16:00:00", created_by_id: 2, updated_by_id: 1, virtual: false, lock_version: 8, description: "", keywords: "", position: 5, role_id: nil, published_revision_number: 3, expires_at: nil, protected_from_changes: false, editor_id: nil, reviewer_id: nil, review_revision_number: nil, state_id: 100, delta: true>]
ruby-1.8.7-p334 :002 > r.excerpt_for :title, Page
Riddle::ResponseError: searchd error (status: 1): unknown local index 'published_with_publication_period' in search request
from /Users/douglas/.rvm/gems/ruby-1.8.7-p334/gems/riddle-1.3.3/lib/riddle/client.rb:668:in `request'
from /Users/douglas/.rvm/gems/ruby-1.8.7-p334/gems/riddle-1.3.3/lib/riddle/client.rb:406:in `excerpts'
from /Users/douglas/.rvm/gems/ruby-1.8.7-p334/gems/thinking-sphinx-1.4.6/lib/thinking_sphinx/search.rb:323:in `excerpt_for'
from (irb):2
My model has 2 indexes defined:
define_index do
set_property :delta => true, :group_concat_max_len => SphinxSearch.content_length || 8.kilobytes
set_property :field_weights => { 'title' => 100 }
indexes title, :sortable => true
indexes parts.content
has created_at, updated_at, status_id, virtual
end
base.define_index 'published_with_publication_period' do
set_property :delta => true, :group_concat_max_len => SphinxSearch.content_length || 8.kilobytes
set_property :field_weights => { 'title' => 100 }
indexes title, :sortable => true
indexes parts.content
has created_at, updated_at, status_id, virtual
db_date = "\"#{Time.zone.today.to_s(:db)}\""
where "((published_at <= #{db_date} AND expires_at > #{db_date}) OR (published_at <= #{db_date} AND expires_at is null) OR (published_at IS NULL AND expires_at > #{db_date}) OR (published_at IS NULL AND expires_at IS NULL))"
end
The error only occurs when I search with the index "published_with_publication_period". I'm working with TS on a Radiant project and I've taken care to make sure that inheritance of my indexed model (Page) doesn't occur until the indexes are defined.