In Subtext 2.5 we changed the internal search provider from the “like %term%” SQL based one to a more mature and powerful one powered by Lucene.net. I wrote about how Lucene.net is implemented inside Subtext, but it didn’t show the benefits for the users. In this post I’m explaining the visible features of the full-text search.
There are 4 places where the new Lucene.net based search engine has its effect:
- Full-text search
- Related links
- More Results for the search
- OpenSearch provider
Full-text search
The first and most obvious place where the new search provider is available is the search result page.
Just type the search keywords in the box and they will be joined with the AND operators and passed to the search engine that will return the list of all matching posts, in order of relevance. The keywords will be searched in the title, the body and in the tags of the post.
For example, if you search for ASP.NET MVC on my blog you will find all the posts that talk about ASP.NET MVC.
More results for the search
The main reason why I decided to include Lucene.net into Subtext is that I wanted to show the readers that come from search engines to find more posts related to their search.
Now if a reader is coming from a search engine, it will find a box that shows other posts that matches the same search.
For example, if you search for “ninject asp.net mvc” on Google, the 2nd or 3rd result is usually my post on how to use Ninject with ASP.NET MVC. If click on the link from the Google search result you will see the new “More Results” box on the top of the page.
This list of posts is retrieved by searching on the full-text index for the same keywords the user used on the search engine.
Related Posts
If you don’t come from a search engine but from a link on twitter or from a link from another site there are no keywords to use. But Lucene.net comes to help since it provides a very useful Similarity plugin which searches the index for documents that are similar to the one selected, using a pretty complex algorithm. Instead of adding them at the top, the related posts are listed the end of each post.
For example, if you go to my post about Ninject on ASP.NET MVC, you can easily find other posts on the same topics.
OpenSearch Provider
The last feature that is related to the search engine is the OpenSearch Provider which allows searching directly on the blog from the search engine box in the toolbar of your browser. For example on Firefox the arrows of the search engines dropdown list will glow in azure, and you will see “Add CodeClimber” if you open the dropdown list. And you will later be able to search on CodeClimber directly from your browser.
How can I add these cool new features to my blog?
First of all you have to install the latest Subtext, version 2.5. And then customize your skin. But I’ll talk about how to do it in a future post.