Faceted search

Have I mentioned how much I love the Sphinx search engine?

I think that I have.

I want to talk about how I used Sphinx to create a new faceted search for Ravelry but I don’t really know where to begin. I’m was happy while working on it and I’m happy with the result. Sphinx itself performs amazingly and that amount of code needed to make it all work is pretty small and very sensible. It’s really surprising how many ways you can take advantage of what it has to offer – someone should really write a “Sphinx Recipes” book.

I’m pretty sure that I spent more time on Javascript micro-optimization than I did on Sphinx performance optimization… but that’s a topic for another day. (Like.. the facet counts that you see are inside of transparent, disabled form fields because updating their values was waaaay faster in IE)

For now, here is a video. It was made to introduce the features to Ravelers so it doesn’t point out any of the technical things that I’d like to show. It’s just a little peek that gives you some idea of what can be done with Sphinx beyond plain old full text search. Sphinx is handling the full text search, the filtering by facet, the computing of counts in each facet, and the selection of results. Pretty much everything other than pulling the data to display the photos and names. All of the work is done in a single call to Sphinx – one query “batch”.

Ravelry Search Help from Ravelry on Vimeo.

One more neat thing: Here is one of the facets in the people search. Sphinx knows how to calculate geodistance so given a search, it can create a facet by grouping results by distance from some point…and it does it fast.

Comments (4)

  1. Van wrote:

    I’m a knitter, therefore I love ravelry. I’m also a programmer learning my way through web development and found your tech blog as equally intriguing. Thanks for posting

    Thursday, September 9, 2010 at 1:00 am #
  2. Sphinx is pretty fricken’ awesome, I agree.

    Actually, if you want to give a talk about Sphinx, there’s a free weekend barcamp-style conference coming up in Boston Oct 16-17, http://www.opensqlcamp.org. There’s lots of info on the site, or e-mail me for more details.

    I’d love to see you there! It’d be great if you could speak too, and I can see about getting a Sphinx developer out here to speak too, so you could learn more and ask questions directly (if you don’t already).

    Thursday, September 16, 2010 at 7:27 pm #
  3. Salman wrote:

    Interesting, I’ve never really given much attention to sphinx. Solr/Lucene seem to grab all the headlines, I think I’m going to read up on the differences after reading up on your experiences.

    Wednesday, February 23, 2011 at 2:39 pm #
  4. Alex Ksikes wrote:

    Nice article! To pull data from MySQL and make faceted search easy, you can check out fSphinx:


    Tuesday, May 17, 2011 at 3:09 am #