heroku ThinkingSphinx::SphinxError (no enabled local indexes to search):
I get this when I run;
heroku run fs:rebuild
Locally it indexes and search works.
Comments are currently closed for this discussion. You can start a new one.
I get this when I run;
heroku run fs:rebuild
Locally it indexes and search works.
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Pat Allan on 22 Jan, 2012 10:33 PM
Hi William
Can you let me know what the name of your app is? I'll investigate and make sure everything's fine on the server side of things.
Pat
3 Posted by William Voll on 22 Jan, 2012 10:38 PM
foa.herokuapp.com
Thanks!
William Voll
[email blocked]
http://about.me/zdweeb
Support Staff 4 Posted by Pat Allan on 22 Jan, 2012 11:03 PM
I'm guessing you're getting this error when searching on Static? There's something not quite right with your index definition in your Static model - either that, or your migrations on the server aren't up to date. Can you confirm the latter, and share your define_index block?
5 Posted by William Voll on 23 Jan, 2012 05:52 PM
Pat,
First thank you so much for your help.
Yes this Model is a problem, I inherited this code so I am not sure if we need it, but would like to get it working just the same.
class Static < ActiveRecord::Base
has_one :box_element, :foreign_key => :element_id
define_index do
indexes :title, :sortable => true
indexes :html
#has created_at
#has updated_at
#has box_element.box.title, :as => :box_title
#has "CAST #{box_element.box.installment.title} AS UNSIGNED INT)", :type => :integer, :as => :installment_title
#has "CAST #{box_element.box.installment_id} AS UNSIGNED INT)", :type => :integer, :as => :installment_id
#has "CAST #{box_element.box.installment.chapter_id} AS UNSIGNED INT)", :type => :integer, :as => :chapter_id
end
def installment
box_element.box.installment
end
end
I had to change this Model to add columns in the group by clause;
class Topic < ActiveRecord::Base
include ActionView::Helpers::TextHelper
acts_as_tree
belongs_to :category, :class_name => 'ForumCategory',
:foreign_key => :category_id
belongs_to :user
has_many :posts, :dependent => :destroy
validates :title, :presence => true
validates :category_id, :presence => true, :unless => :subtopic?
validates :user_id, :presence => true
scope :subtopic, where('parent_id is not null')
scope :order_by_posts, joins(:posts).order('posts.created_at desc').group('topics.created_at','topics.updated_at'',topics.user_id','topics.description','topics.parent_id','topics.id','posts.created_at', 'topics.title', 'topics.category_id')
accepts_nested_attributes_for :posts
accepts_nested_attributes_for :parent
acts_as_followable
define_index do
indexes title
has created_at
has updated_at
has user_id
has parent_id
end
def subtopic?
parent.present?
end
def parent_topic
try(:parent)
end
alias_method :category!, :category
def category
subtopic? ? parent.try(:category) : category!
end
def forum
category.try(:forum)
end
def book
category.try(:installment).try(:book)
end
def child_posts
if subtopic?
@child_posts ||= posts.order(&:created_at)
else
@child_posts ||= children.map{|t| t.posts}.flatten.compact.sort_by(&:created_at)
end
end
def contributors
@contributors ||= child_posts.map(&:user).uniq
end
def build_parent_topic
unless subtopic?
build_parent(
:title => title,
:description => description,
:user_id => user_id,
:category_id => category_id
)
self.description = nil
self.category_id = nil
end
end
def make_as_parent
self.description = parent.description
self.category_id = parent.category_id
self.parent = nil
end
def contributor_list
if contributors.count < 4
contributors.sort_by(&:level).map{|u| u.link}.join(', ')
else
list = contributors.sort_by(&:level)
first_users = list[0..3].map{|u| u.link}.join(', ')
second_users_count = contributors.count - 3
second_users = pluralize(second_users_count, 'other')
"#{first_users}, and #{second_users}"
end
end
end
William Voll
[email blocked]
http://about.me/zdweeb
Support Staff 6 Posted by Pat Allan on 24 Jan, 2012 11:30 AM
The issue here in Static is the last three attributes (all commented out) - the column references can't be used as strings in SQL, and that's what was generating an incorrect index definition. Have you deployed and rebuilt your Sphinx setup since commenting those lines out?
Pat
7 Posted by William Voll on 25 Jan, 2012 02:12 PM
I thought I did be for contacting the board, I will try again.
William Voll
[email blocked]
http://about.me/zdweeb
Support Staff 8 Posted by Pat Allan on 26 Jan, 2012 01:04 PM
Looks like indexing was successful in recent attempts - does searching work fine now for you?
Pat Allan closed this discussion on 17 Oct, 2012 11:42 PM.