Developer forum

Forum » Development » Exception in 9.4.7 when using product name as lucene sort field

Exception in 9.4.7 when using product name as lucene sort field

Anders Ebdrup
Anders Ebdrup
Reply

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


Replies

 
Nicolai Pedersen
Reply

Hi Anders

Can you provide a dump of your setup so we can reproduce?

Thanks, Nicolai

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Nicolai,

 

Do you need a backup of the database? And should I instead submit the issue to the support?

 

Best regards, Anders

 
Nicolai Pedersen
Reply

No, just a couple of dumps on your setup/use case so I can reproduce it.

Thanks, Nicolai

 
Anders Ebdrup
Anders Ebdrup
Reply

Hi Nicolai,

 

After moving this to another environment, I cannot reproduce this issue any more.

I am sorry for report.

 

Best regards, Anders

 

You must be logged in to post in the forum