Looks like I jumped the gun on my report. It seems this change "fixed"
the problem for only the first run of search. That is, running my app
from the browser, searching the Post class generates search results
nicely. But the second time any search is run, a strange exception is
raised:
Processing PostsController#search (for 127.0.0.1 at 2009-12-21
22:42:48) [GET]
Parameters: {"commit"=>"Search", "q"=>"ogbono and body fat"}
Sphinx Querying: 'ogbono and body fat'
Sphinx (0.010020s) Found 8 results
Post Load (0.4ms) SELECT * FROM `posts` WHERE (`posts`.`id` IN
(666,233,662,700,706,718,719,720))
Topic Columns (1.5ms) SHOW FIELDS FROM `topics`
TypeError (can't dup NilClass):
lib/plugin_extensions.rb:25:in `search'
/usr/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.14/lib/
thinking_sphinx/search.rb:116:in `each'
/usr/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.14/lib/
thinking_sphinx/search.rb:116:in `send'
/usr/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.14/lib/
thinking_sphinx/search.rb:116:in `method_missing'
lib/plugin_extensions.rb:24:in `search'
Here is the "search" method mentioned above:
def search
@posts = Post.search params[:q]#, :page => params[:page]
# hack! hack! hack! thinking_sphinx does not include
virtual attributes in results
@posts.each do |post|
post.topic_title =post.topic.title
... etc ...
Line 24 is: @posts.each do |post|
Line 25 is: post.topic_title =post.topic.title
Like I said, firing up ./script/server, the first time through this
method, no problems. But every subsequent time this method is called,
it barfs on Line 25.
Interesting that in version 1.3.13, it was barfing at Line 24 -- i.e.
just on @posts.each being called. Now, with 1.3.14, @posts seems ok
(i.e. I can query it using 'each'), but there seems to be a problem
with the individual post objects, or something related to them.
BTW -- every Post object belongs to a valid Topic object in this db,
so post.topic is never nil in this data set.
Also, as with before, I can't replicate this problem running
Post.search in the console and querying the resulting Post objects. I
can issue as many searches, and query as many of the search results as
I like in console. Nothing blows up. This is just a browser-run app
problem.
Thanks again for the attention on this one. I'll try to dig deeper
into TS tomorrow to figure this one out.
On Dec 21, 5:39 pm, "[email protected]"
<[email protected]> wrote:
> Hi Pat:
>
> So, I run 2 apps of the staging box, and they seem to be consistently
> running w/o a problem right now on Ubuntu. I'll be deploying several
> times this week, so I'll update you if something goes south.
--
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.