Erik,

You're a genius. That did the trick for getting "something" back. I'll be at
the code4lib conference (and pre-conference) in Atlanta and I'll be looking
forward to talking with you. 

Another question...
The controller:
@query= Movie.find_by_solr(params[:squery])
Then in the view:
<label><%= @query %></label>

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?

Thanks,
Mike

-----Original Message-----
From: Erik Hatcher [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 18, 2006 4:06 PM
To: solr-user@lucene.apache.org
Subject: Re: Newbie Question acts_as_solr

Mike,

Yes, Solr needs to be running within a Java web application server to  
operate.  Like a database server, for example.

Try Movie.find_by_solr, not lowercase "movie".  find_by_solr is a  
class-level method, not an instance method.

        Erik


On Dec 18, 2006, at 4:01 PM, Mike Beccaria wrote:

> Hi all,
>
> Forgive me for the newbie questions (the questions rolling in here  
> seem to
> be way over my current level of competence). I'm learning ruby on  
> rails to
> implement a searchable catalog of items and want to use the  
> acts_as_solr
> plugin to eventually create a faceted search design.
>
> I feel awkward even asking this as it may seem so basic that I may be
> missing something obvious, but no online tutorials seem to walk  
> through the
> process from start to finish.
>
> I watched the movie on http://acts-as-solr.rubyforge.org/ and I can  
> get the
> application to work from the console (switching the schema.xml file,
> starting the java server thingy and all that) but I am having trouble
> implementing it in a rails web application. How does the Java server
> interact with rails? To use acts_as_solr in a web based application  
> (search
> box->results list) should I start the java server like in the  
> tutorial?
>
> Anyway, I'm trying to make the simplest search box and results list
> possible. I'm getting and "undefined method `find_by_solr' for
> #<Movie:0x367a6f8>" error with the files below. I know it's got to be
> something dumb and obvious. Can someone point me in the right  
> direction? It
> would be much appreciated.
>
> Thanks,
> Mike Beccaria
> Systems Librarian
> Paul Smith's College
>
>
> Here is my rails outline:
> Search_controller.rb:
> class SearchController < ApplicationController
>  def index
>  end
>   def searchdb
>     movie=Movie.new
>     @query= movie.find_by_solr(params[:squery])
>   end
> end
>
> /models/movie.rb:
> class Movie < ActiveRecord::Base
>   acts_as_solr
> end
>
> /views/search/index.rhtml:
> <html>
> <head>
> <title> Test!!!</title>
> </head>
> <body>
> <%= start_form_tag :controller=>'search', :action=>'searchdb' %>
>   <p>Enter Search Term:
>   <%= text_field_tag :squery%>
> </p>
>   <p>
>   <%= submit_tag( "Search") %>
>   </p>
> <%= end_form_tag %>
> </body>
> </html>
>
> /views/search/searchdb.rhtml:
> <html>
> <head>
>       <title> Hello!!!test</title>
> </head>
> <body>
>       <label><%= @query %></label>
> </body>
> </html>
>
> 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>>>>

Reply via email to