Erik
Awesome. Debug is helpful. I also found that for awhile I was using <%
instead of <%= and that caused some problems :) You've been very helpful!
Thank you.
Mike
-Original Message-
From: Erik Hatcher [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 19, 2006 11:07 AM
To: solr-user@lucene.apache.org
Subject: Re: Newbie Question acts_as_solr
On Dec 18, 2006, at 8:36 PM, Mike Beccaria wrote:
> Another question...
> The controller:
> @query= Movie.find_by_solr(params[:squery])
> Then in the view:
> <%= @query %>
Debugging tip: use <%= debug @query %> to see exactly what you got.
> Produces 2 hits (as per count_by_solr) that look like this : "##"
>
> Why does it return a "#" and how do you return the result
> attributes (like
> title or synopsis etc.) in the array? Do you have to run a find on the
> database at that point?
find_by_solr is designed to pull the database records by primary key
after it searches Solr, so what you get back is the same kind of
thing you'd get back if you did a regular ActiveRecord
#find_all_by_. In other words, you get an array of Movie
objects back. So try using @query.each loop to display each hit.
I'd call it something besides @query, since it really is @results :)
Erik
The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s) and
may contain confidential or privileged Information. If you are not the
intended recipient, please notify the sender immediately or reply via e-mail
and destroy all copies of the message and any attachments. Thank you.
<<<>>>