Sitecore 7 Search Issues
LINQ query against empty string
May 5, 2014
I was working on a Sitecore 7 project, version 7.0 rev. 130424, and was trying to do a empty string compare using Sitecore’s search LINQ to Lucene queries. The query was relatively simple and looked like this:
After working with Sitecore Support, I found out that the only way to perform the search, which is how I was getting results initially, was to move the string comparison outside of the LINQ to Lucene query and put it in a foreach loop, like so:
According to Support, this issue was resolved starting from Sitecore 7.0 Update 3 (rev. 131127), where you may use the query as follows:
Furthermore, starting from Update-3 you might see a different set of results returned when using Contains, StartsWith, EndsWith, Equals, Like, and MatchWildcard Linq operators.
Also, the EndsWith() operator now requires the specified field to be stored in the index with termvector offsets.
Tags: SQL
Back to Posts