Wednesday, December 26, 2012

Lucene Search - Search All Fields in Sitecore

Recently, I was having troubled trying to figure out why I couldn't get any hits from querying a custom field that I have added programmatically onto Lucene Index. Now beside the customization I have added, I have used Sitecore Advanced Database Crawler that makes life easier working with Lucene and Sitecore.

Anyway, after digging and debugging, I found out that when searching for all Sitecore field through the index, it actually searching on 1 single field in Lucene Index. Essentially this single field in single Lucene Document contain the value of all the fields in a single Sitecore Item. This field in Lucene is called "_content"

For this reason, if I need to search both all of Sitecore fields and the additional fields I have created, I will need to modify the query to search for both "_content" and "additional fields" I have created.