Codeblocked: An Adventure in Slow Code

dp, 16 December 2009, View Comments
Categories: Uncategorized
Tags: ,

It’s amazing how much content a company can add in a year, especially when that company writes articles for it’s living. A year and a half ago, I wrote this code against Sphinx:

$cl = new SphinxClient ();
$res = $cl->Query ( $q, $index );
foreach ( $res["matches"] as $docinfo ) {
    $excerpt = $cl->BuildExcerpts(array($contents), $index, $q, $options);
}

Now, for those of you that don’t know, Sphinx’s BuildExcerpts function takes an array of textual scalar values, and generates the excerpts from them. If you’ll notice, I’m cutting off BuildExcerpts at the knees.

18 months and a million searches later, and I’m trying to revamp this. It’s not looking much prettier, but it is *much* faster….

Reblog this post [with Zemanta]

Comments

blog comments powered by Disqus