Forum: Ferret Highlight slowness

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7b74ccf93dde7dd2ac5d2980d14fdc7b?d=identicon&s=25 Paul Lynch (Guest)
on 2007-06-12 00:08
Has anyone else found that using ferret's highlighting slows searches
down significantly?  I am seeing that it more than doubles the search
time on my system.  I am returning up to 500 results at once, so the
slow down is quite noticeable (probably adding about .7 seconds for
searches with large result sets.)
   --Paul
2764460fe747a1b6ca462fc71768ea50?d=identicon&s=25 Jesse Grosjean (Guest)
on 2007-06-27 16:53
Paul Lynch wrote:
> Has anyone else found that using ferret's highlighting slows searches
> down significantly?  I am seeing that it more than doubles the search
> time on my system.  I am returning up to 500 results at once, so the
> slow down is quite noticeable (probably adding about .7 seconds for
> searches with large result sets.)
>    --Paul

Are you using lazy loading? If so the problem might be that you are not
loading anything from your database when doing non-highlight searches
(good! fast), but you are when you do a highlight search (bad! slow)

Or that might not have anything to do with it, I'm still learning ferret
and rails.

See this post:

http://www.ruby-forum.com/topic/111027#264368

Jesse
7bc1c1d2b813be5db6ea036a9da0e7ed?d=identicon&s=25 Pierre-Yves Landanger (Guest)
on 2007-07-03 18:28
Paul Lynch wrote:
> Has anyone else found that using ferret's highlighting slows searches
> down significantly?  I am seeing that it more than doubles the search
> time on my system.  I am returning up to 500 results at once, so the
> slow down is quite noticeable (probably adding about .7 seconds for
> searches with large result sets.)
>    --Paul

Hello Paul,

I got the same problem.

highlighting performance are based on the tolerance you selected.
Example  for me :

QUERY~1 is fast.  < 10 ms
QUERY~0.9 is slower. < 50 ms
QUERY~0.8 is slow. = 1 sec
QUERY~0.7 is very slow. > 2 sec
...

If anyone have a solution to speed it up, i would appreciate too.
7bc1c1d2b813be5db6ea036a9da0e7ed?d=identicon&s=25 Landanger Pierre-Yves (Guest)
on 2007-07-03 19:02
Here how i do highlighting


in my model :
acts_as_ferret :fields => { :content => {:store => :yes}, :title  =>
{:store => :yes}}

results = list.find_by_contents("QUERY~7", options)


In my view :
<% results[0].highlight("QUERY~7", :field => :content,... ) -%>

Is there a way to make it faster without changing the tolerance factor ?
( ~7 in this example )
C9dd93aa135988cabf9183d3210665ca?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-07-04 09:50
(Received via mailing list)
On Tue, Jul 03, 2007 at 07:02:26PM +0200, Landanger Pierre-Yves wrote:
> In my view :
> <% results[0].highlight("QUERY~7", :field => :content,... ) -%>
>
> Is there a way to make it faster without changing the tolerance factor ?
> ( ~7 in this example )

I could imagine that doing the highlighting right inside
find_by_contents could speed up things quite a bit, maybe something
like:

results = list.find_by_contents("QUERY~7", :highlight => { :field =>
:content })

I'd happily apply a patch for this, or just file it as a feature request
in aaf's Trac ;-)

Jens

--
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
kraemer@webit.de | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
This topic is locked and can not be replied to.