Hello!
I’m trying to highlight my search results, but it doesn’t work.-
In the model i have this:
acts_as_ferret( :fields => {
:name => {:store => :yes , :boots => 100},
:description => {:store => :yes , :boots => 50}
})
…and i’m using find_with_ferret, so, in the controller i have this:
@repos = Repo.find_with_ferret(cad)
I don’t know what to do in the view, because everything i try never
works.
I hope you can help me.
Thanks and I apologize by my bad english!!!
I’m also having trouble with highlighting and would appreciate seeing an
answer to this.
Thanks,
JT
JT Kimbell wrote:
I’m also having trouble with highlighting and would appreciate seeing an
answer to this.
well, this is the solution that worked for me.
in the controller:
def busqueda
@cad = prepare_query(params[:query])
@repos = Repo.find_with_ferret(@cad)
end
in the view:
<% for repo in @repos %>
<%= repo.highlight(@cad, :field=> :name , :pre_tag => “” ,
:post_tag=>"" %>
<% end %>
in the model:
acts_as_ferret( :fields => {:name => {:store => :yes , :boost => 2}})
my english is really bad, so i’m sorry
bye!