Software Engineer, Sitecore Certified Trainer & Expert
22. November 2013
Sitecore 7 Content Search
I used to have a lot of trouble with the integration of Lucene into Sitecore in previous iterations.
The configuration was difficult and many things were missing. Did you ever try to search in Japanese? No? Well, there is no need to try, because it just won't work without a custom implementation.
Let’s not longer talk about the past but focus on the current situation. Sitecore has done an incredibly good job with the implementation of new features in Sitecore 7.
So what's new in Sitecore 7?
- LINQ –You are now able to write your searches accordingly to normal LINQ logic.
- POCOs – You will get every result you want, with the custom mapping of Sitecore. Just write your class and Sitecore will map the properties for you.
- Standard Index – Sitecore 7 comes with an index for each database and they are pretty reliable and useful.
- Updateable – You are now able to switch to other Lucene versions. Sitecore is no longer married to one Lucene Version. Keep in mind that you still have to use Lucene .NET
- Changeable – You don’t have to use Lucene, you can implement whatever you like.
- Scalable – If you have a large multiserver site, you should definitely use SOLR in combination with Sitecore7. Simply bercause SOLR can automatically distribute queries in a cluster setup.
- Config – No more spaghetti code mess, just simple steps will instantly get you the desired results.
- Custom Analyzer – You can attach your own analyzer for one language or just for one field for as many languages or fields as you wish.
- Fields – There is much more flexibility to it. Define how it will be crawled or saved. You can even boost a field to get it up in the result set.
- Future – The future looks bright. They are planning on implementing a lot more functionality. For example: spelling correction or auto suggest, auto mapping for complex field types and much more.
To get you motivated to play with it, here is a little example of how to use the index:
var index = ContentSearchManager.GetIndex("sitecore_master_index");
using (var context = index.CreateSearchContext())
IQueryable<SearchResultItem> searchItems = context.GetQueryable<SearchResultItem>();
searchItems = searchItems.Where(item => item.Content.Like (SearchTerm));
That’s it for today. Good luck with your search!