Posted on 02/11/2015 12:27:29
Hi Rasmus,
The sort works, though probably not as you expect. The issue is that Lucene uses ordinal sort, which means that there's a difference between uppercase and lowercase letters. The solution is to sort on a field that has only one casing or is analyzed without differentiation between uppercase and lowercase. This becomes even trickier when using an analyzed field as it might strip parts that does not match ruleset of the tokenizer.
There are two ways to solve the issue, though one solution requires Dynamicweb 8.7 or later.
The easiest (and the one the requires 8.7+) is to create a new Field Type in the index definition and select the CaseInsensitiveKeywordAnalyser
. Then create a new field that uses the source you need (probably ProductName
going by your post) and select your custom Field Type under Type for the field.
The second solution requires you to implement an IIndexBuilderExtender<ProductIndexBuilder>
that copies the value of the field in question into a new field that is lowercase. You can see how to create one here: http://developer.dynamicweb.com/forum/cms-standard-features/new-index-sort-product-order-in-product-group.aspx?PID=48
I would only recommend the second solution if you're forced to use Dynamicweb 8.6.1.X. If you're using Dynamicweb 8.7 or later, then the first solution is by far the best.
- Jeppe