Hi Pat,
Item:
define_index do
indexes :title
indexes :description
has project_id, :as => :project_id
end
Page:
define_index do
indexes versions.title, :as => :title
indexes versions.text, :as => :text
has project_id, :as => :project_id
end
Post:
define_index do
indexes :body
indexes topic.title, :as => :title
has forum.project_id, :as => :project_id
end
Martijn
On Aug 5, 2:52 pm, Pat Allan <[email protected]> wrote:
> Hi Martijn
>
> Thanks for the update with the latest stack trace. It's odd that it's
> one model in particular that's having problems. Can you share your
> define_index blocks for each model?
>
> --
> Pat
>
> On 05/08/2009, at 1:10 PM, Martijn wrote:
>
>
>
> > Hi Pat,
>
> > Thanks for the reply. I've updated to the latest version of TS now.
> > The error stays though...
>
> > Querying Sphinx: lorem
>
> > ActionView::TemplateError (undefined method `constantize' for
> > nil:NilClass) on line #8 of projects/search.html.erb:
>
> > 8: <%- @contributions.each do |contribution| %>
> > ...
> > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> > 615:in `class_from_crc'
> > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> > 601:in `instances_from_matches'
> > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> > 599:in `each'
> > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> > 599:in `instances_from_matches'
> > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> > 219:in `populate'
> > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> > 284:in `call'
> > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> > 284:in `retry_on_stale_index'
> > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> > 205:in `populate'
> > vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:78:in
> > `method_missing'
>
> > The strange thing is, I search over 3 models; Post, Page and Item. I
> > only get this error when I search for text that appears in a Post. It
> > only happens at staging as well - on my development machine everything
> > works.
>
> > regards,
> > Martijn
>
> > On Aug 4, 9:41 pm, Pat Allan <[email protected]> wrote:
> >> Hi Martijn
>
> >> Not entirely sure why this is happening - but it appears you're using
> >> an old version of TS, so that makes it a bit hard to debug. Would you
> >> be able to update to the latest and try again?
>
> >> Also, I've deprecated ThinkingSphinx::Search.search for
> >> ThinkingSphinx.search in recent versions (1.2.x) - although the old
> >> syntax still works.
>
> >> Cheers
>
> >> --
> >> Pat
>
> >> On 04/08/2009, at 4:38 PM, Martijn wrote:
>
> >>> Hi all,
>
> >>> On my staging environment, I want to search over multiple models.
> >>> If I
> >>> search models individually, everything works fine. However, if I
> >>> search using ThinkingSphinx::Search.search 'something' - I get the
> >>> following error:
>
> >>> NoMethodError (undefined method `constantize' for nil:NilClass):
> >>> /vendor/plugins/thinking-sphinx/lib/thinking_sphinx/
> >>> collection.rb:
> >>> 101:in `class_from_crc'
> >>> /vendor/plugins/thinking-sphinx/lib/thinking_sphinx/
> >>> collection.rb:
> >>> 80:in `instances_from_classes'
> >>> /vendor/plugins/thinking-sphinx/lib/thinking_sphinx/
> >>> collection.rb:
> >>> 78:in `each'
> >>> /vendor/plugins/thinking-sphinx/lib/thinking_sphinx/
> >>> collection.rb:
> >>> 78:in `instances_from_classes'
> >>> /vendor/plugins/thinking-sphinx/lib/thinking_sphinx/
> >>> collection.rb:
> >>> 39:in `instances_from_matches'
> >>> /vendor/plugins/thinking-sphinx/lib/thinking_sphinx/
> >>> collection.rb:
> >>> 31:in `create_from_results'
> >>> /vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> >>> 371:in `search'
> >>> /vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> >>> 388:in `call'
> >>> /vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> >>> 388:in `retry_search_on_stale_index'
> >>> /vendor/plugins/thinking-sphinx/lib/thinking_sphinx/search.rb:
> >>> 363:in `search'
>
> >>> Everything works on development though. Why do I get this error on
> >>> staging? Help is greatly appreciated!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---