I''m trying to highlight keyword snippets using the highlight method of the results returned from find_by_contents (the actual models), but always come up with an empty array. Any ideas what could be going wrong? -- Posted via http://www.ruby-forum.com/.
curtis.hatter at insightbb.com
2006-Nov-02 21:48 UTC
[Ferret-talk] highlighting with find_by_contents
Have you defined the field(s) as storable? Link to FieldInfo class: http://ferret.davebalmain.com/api/classes/Ferret/Index/FieldInfo.html You need to set up your fields with acts_as_ferret. This is how I have mine setup (still learning Ferret and AAF so may not be totally correct but highlighting works): acts_as_ferret( :fields => { ? :name => {}, ? :desc => {}, ? :body => {:store => :yes}, ? :role => {}, }) This allows me to use the highlighting with the "body" field. The other ones still can''t highlight. Curtis ----- Original Message ----- From: Britt Selvitelle <anotherbritt at gmail.com> Date: Thursday, November 2, 2006 13:57 Subject: [Ferret-talk] highlighting with find_by_contents To: ferret-talk at rubyforge.org> I''m trying to highlight keyword snippets using the highlight > method of > the results returned from find_by_contents (the actual models), > but > always come up with an empty array. Any ideas what could be > going wrong? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20061102/ae89831a/attachment.html
Thanks Curtis and Jens. That worked great (after rebuilding index)! Britt On 11/2/06, curtis.hatter at insightbb.com <curtis.hatter at insightbb.com> wrote:> Have you defined the field(s) as storable? > > Link to FieldInfo class: > http://ferret.davebalmain.com/api/classes/Ferret/Index/FieldInfo.html > > You need to set up your fields with acts_as_ferret. This is how I have mine > setup (still learning Ferret and AAF so may not be totally correct but > highlighting works): > > acts_as_ferret( :fields => { > :name => {}, > :desc => {}, > :body => {:store => :yes}, > :role => {}, > }) > > This allows me to use the highlighting with the "body" field. The other ones > still can''t highlight. > > Curtis > > ----- Original Message ----- > From: Britt Selvitelle <anotherbritt at gmail.com> > Date: Thursday, November 2, 2006 13:57 > Subject: [Ferret-talk] highlighting with find_by_contents > To: ferret-talk at rubyforge.org > > > I''m trying to highlight keyword snippets using the highlight > > method of > > the results returned from find_by_contents (the actual models), > > but > > always come up with an empty array. Any ideas what could be > > going wrong? > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Ferret-talk mailing list > > Ferret-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ferret-talk > > > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk > >