I finally got around to implementing a search feature on this site. If you search for something in the bar over on the right side of the page, you’ll get a search over all the blog posts, photo, and photo albums on this site.
I did all this with the Zend Framework’s PHP implementation of Lucene. It seems to give good results very quickly, although there are some issues I’m having that are either misunderstandings or outright bugs. Or maybe it’s because I’ve been up till 4am fiddling with this thing. Tomorrow I’ll try to simplify my scenario and see if I still get the same results... if not, then I guess I need to figure out where I’ve missed something. I’ve found that the way you design a search index is quite a bit different from the way you work with a relational database, mainly because you intentionally denormalize data for the sake of faster searching, when you wouldn’t do that for a relational database (at least not until you found that some particular JOIN or something was a huge bottleneck).
Anyway, I need to get some sleep. If you try out my search box and notice something particularly odd, let me know. (Well, something other than the styling, which isn’t fully presentable yet.) Most of the problems I’m having are with more advanced queries that aren’t working the way the documentation claims they should, but it shouldn’t be anything most users would ever see.
Update: I figured out what was wrong, it was due to using the default query parser, when I needed to construct the query from APIs. After writing my own query processor, all is well. More info about the specific problem I was having can be found on this Stack Overflow question, which pointed me in the right direction.