Codeblocked: An Adventure in Slow Code

dp, 16 December 2009, View Comments
Categories: Software
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]

Related posts:

  1. The Quick and Dirty Guide to a Successful Website Deployment – Part 1: Research So, you’ve been charged with the responsibility of giving your...

Comments

blog comments powered by Disqus