Hi guys,
I have a problem with creating my views. I fetch results from
Ultrasphinx::Search#excerpt (http://blog.evanweaver.com/files/doc/
fauna/ultrasphinx/classes/Ultrasphinx/Search.html#M000026).
The problem is that this method only highlights the results, without
actually cropping the unnecessary stuff left and right from the
searched words. A fragment from my config/environment.rb:
Ultrasphinx::Search.excerpting_options HashWithIndifferentAccess.new({
:before_match => ''<strong>'',
:after_match => ''</strong>'',
:chunk_separator => "...",
:limit => 256,
:around => 2, # This doesn''t seem to work
:content_methods => [''search_content'']
})
The search_content method is in all searchable models, it returns all
the indexed fields concatenated together.
For example, if I looked for "foo" in a model, for which
search_content returns "this is a long foo sentence with some more of
this foo stuff", running excerpt gives me:
- actual: "this is a long <strong>foo</strong> sentence with
some more
of this <strong>foo</strong> stuff"
- expected: "...a long <strong>foo</strong> sentence with ...
of this
<strong>foo</strong> stuff"
Could someone help me on this?
Then, I fought of skipping Ultrasphinx''s excerpt, and manually replace
the unnecessary parts with ''...''. Unfortunately
TextHelper#excerpt
accepts only one string to excerpt, and I have an array of strings.
Is there some way to achieve what I need without struggling manually
with the strings/regexp/etc.?
I would really appreciate your help.
--
Bye,
Olek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---