[prev in list] [next in list] [prev in thread] [next in thread] 

List:       solr-user
Subject:    RE: Newbie Question acts_as_solr
From:       "Mike Beccaria" <beccarm () paulsmiths ! edu>
Date:       2006-12-19 17:24:14
Message-ID: 015601c72392$81b6b2a0$4315ce0a () Beccaria
[Download RAW message or body]

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:erik@ehatchersolutions.com] 
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:
> <label><%= @query %></label>

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_<whatever>.  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.
<<<<GWAVAsig>>>>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic