Exclude Context Item from Sitecore Lucene Search Results
The Problem:
I'm trying to build a related items functionality but I'm picking up the
context item in my results as well.
The Implementation:
I'm trying to use a FieldSearchParam to exclude a list of items from results:
var fieldParam = new FieldSearchParam()
{
Condition = QueryOccurance.MustNot,
FieldName = BuiltinFields.ID,
FieldValue = item.ID.ToString().Replace("{", "").Replace("}",
"").Replace("-", "").ToLower() + "~",
};
Believe me, I'm aware how nasty that FieldValue is, but the index doesn't
hold the standard Sitecore Item GUID format.
The Question:
First of all, is there a better way to format the item guid for lucene
comparison? This implementation wouldn't even cover different languages.
Secondly, why aren't my items getting excluded?
No comments:
Post a Comment