Wednesday, April 27, 2016

Sitecore Lucene inconsistencies with urllink field

In the default configuration file for Lucene in Sitecore there is a field indexed and stored by default called urllink. This file is found under App_Config/Include and is called: Sitecore.ContentSearch.Lucene.DefaultIndexConfiguration.config. The purpose of this field is to store the URL to the indexed item and the field index is defined as:

<field fieldName="urllink"              storageType="YES" indexType="TOKENIZED"    vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
  <analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>

When I implement search functionality in Sitecore, I store all of the required field values in the index so that at search time no queries need to be made to Sitecore (this speeds up the search). The main problem with using the urllink field is inconsistencies in the URL is the fact that sitecore/shell appears in the URL for some media items.

This was discussed in a Stack Overflow post some years ago and Sitecore did not recommend using this field - and apparently it will be removed in the future... The post there suggests querying Sitecore at search time for a URL, however I am a fan of the custom computed index field approach to keep my Lucene search optimized.

No comments:

Post a Comment