Hi Dynamicweb,
I get this error in 9.4.7 when using the product name as the sort field in the lucene query setup:
System.IndexOutOfRangeException: Index was outside the bounds of the array. at Dynamicweb.Indexing.Lucene.LuceneIndexProvider.CaseIgonreComparator.CompareBottom(Int32 doc) at Lucene.Net.Search.TopFieldCollector.OneComparatorScoringMaxScoreCollector.Collect(Int32 doc) at Lucene.Net.Search.IndexSearcher.SearchWithFilter(IndexReader reader, Weight weight, Filter filter, Collector collector) at Lucene.Net.Search.IndexSearcher.Search(Weight weight, Filter filter, Collector collector) at Lucene.Net.Search.IndexSearcher.Search(Weight weight, Filter filter, Int32 nDocs, Sort sort, Boolean fillFields) at Lucene.Net.Search.IndexSearcher.Search(Weight weight, Filter filter, Int32 nDocs, Sort sort) at Dynamicweb.Indexing.Lucene.LuceneIndexProvider.SearchInternal(IQuery query, QuerySettings settings) at Dynamicweb.Ecommerce.Frontend.Frontend.GetProductsFromIndexQuery()
This is some of the source code from LuceneIndexProvider.cs:
public override int CompareBottom(int doc) => CompareValues(bottom, values[doc]); public override void Copy(int slot, int doc) { values[slot] = currentValues[doc]; } public override void SetBottom(int slot) { bottom = values[slot]; } public override void SetNextReader(IndexReader reader, int docBase) { currentValues = FieldCache_Fields.DEFAULT.GetStrings(reader, fieldName); }
Where I think that you will have to change this line:
public override int CompareBottom(int doc) => CompareValues(bottom, values[doc]);
To:
public override int CompareBottom(int doc) => CompareValues(bottom, currentValues[doc]);
As then "doc" is used as parameter, then you should use "currentValues" and not "values" which is based on the slots.
Best regards, Anders