http://wiki.rubyonrails.com/rails/pages/HowToIntegrateFerretWithRails
I followed everything here but at the last I get when loading page
get_results
Can only handle a String or a Query.
RAILS_ROOT: script/…/config/…
Application Trace | Framework Trace | Full Trace
#{RAILS_ROOT}/app/models/result.rb:27:in search_each' #{RAILS_ROOT}/app/models/result.rb:27:in
search_index’
#{RAILS_ROOT}/app/models/result.rb:15:in count' #{RAILS_ROOT}/app/controllers/search_controller.rb:25:in
get_results’
I’m beat, I did everything I mostly understand what is happeneing on
the code… But still nothing
Though at
require ‘ferret’
module FerretConfig
include Ferret
INDEX = Index::Index.new(:path =>
‘f:/home/jan/workspace/ferret_test/index’)
end
I just changed ‘f:/home/jan/workspace/ferret_test/index’) to ‘index’
since it is root in my folder and i’m on OSX tiger
Our site has a Ferret-based search engine on OSX and we didn’t need
anything
special to get it running. We do specify the full path to the index
directory, so you may try that. Can you post the code that throws these
errors?
Jeff
Jeff Everett wrote:
Our site has a Ferret-based search engine on OSX and we didn’t need
anything
special to get it running. We do specify the full path to the index
directory, so you may try that. Can you post the code that throws these
errors?
Jeff
class SearchController < ApplicationController
# initial creation of a lucene index
def create_index
# our central INDEX
index = FerretConfig::INDEX
# get all Favorites, iterate over and index them
favourites = Favourite.find(:all)
for fav in favourites
index << {:key => fav.id, :title => fav.title, :teaser =>
fav.teaser, :url => fav.link}
end
# don't close the index, but be sure to write it to the fs
index.optimize()
redirect_to(:action => 'search_form')
end
def get_results
#we'll handle over the search_term to the view for following
paginator searches
if (params[:search])
@search_term = params[:search][:search_term]
else # is it a paginator search?
@search_term = params[:search_term]
end
condition = 'teaser:"' + @search_term + '"'
# we'll use the standard rails paginator
@result_pages, @results = paginate(:result, :per_page => 5,
:conditions => condition)
return @result_pages, @results, @search_term
end
end
trip dragon [email protected] writes:
http://wiki.rubyonrails.com/rails/pages/HowToIntegrateFerretWithRails
I followed everything here but at the last I get when loading page
get_results
try acts_as_ferret, it will make using ferret dead simple.
Cheers.
–
Surendra S.
http://ssinghi.kreeti.com, http://www.kreeti.com
Read my blog at: http://cuttingtheredtape.blogspot.com/
,----
| “War is Peace! Freedom is Slavery! Ignorance is Strength!”
| – Orwell, 1984, 1948
`----