Developer forum

Forum » Swift » Index out of range error when trying to sort product list having more than 1 value on SortBy

Index out of range error when trying to sort product list having more than 1 value on SortBy

Pedro Meias
Pedro Meias
Reply

Hi

Testing on DW 9.16.6, Swift 1.25.1

Test Environment - https://cleanswift.mydwsite1.com/

We are trying to sort a product list having more that one criteria on SortBy.

Here is a url example - https://cleanswift.mydwsite1.com/e-bikes/e-mountain-bikes?PageSize=12&RequestType=UpdateList&SortBy=-Price,Name

We are getting the following error

An error occurred while attaching module (Dynamicweb.Frontend.Content)

 

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Dynamicweb.Indexing.Querying.QueryHelper.GetSortInformation(IQuery query, String sortBy, IList`1 sortDirections)
   at Dynamicweb.Ecommerce.Indexing.ProductQueryHelper.GetSortInformation(IQuery query, ProductCatalogSettings settings, String groupId)
   at Dynamicweb.Ecommerce.Indexing.ProductQueryHelper.CreateQuerySettings(ProductCatalogSettings settings, IQuery query, PagingHandler pagingHandler, NameValueCollection requestValues)
   at Dynamicweb.Ecommerce.Indexing.ProductQueryHelper.GetQueryAndQuerySettings(ProductCatalogSettings settings, ContentModule contentModule, NameValueCollection requestValues, QuerySettings& querySettings)
   at Dynamicweb.Ecommerce.ProductCatalog.ProductCatalogFrontend.GetContent()
   at Dynamicweb.Frontend.Content.GetModuleOutput(Paragraph paragraph, PageView pageview)

 

Looking at DW code, on file Dynamicweb.Indexing/Querying/QueryHelper.cs we see the following

It seems the sortInfoes object is not expected to have more than one entry.

Can you please clarify if this is the expected behavior or a bug?

Thank you.


Replies

 
Melissa Borgmann
Melissa Borgmann
Reply

Any update on this one?

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi,

the issue has been approved as valid bug, will be fixed by task #18312. Thanks.

BR, Oleg QA 

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply
This post has been marked as an answer

Hi Pedro and Melissa

The bugfix #18312 regarding Index out of range error when trying to sort product list having more than 1 value on SortBy

Now foxed in Dynamicweb version 9.17.3
Get this from the download section https://doc.dynamicweb.dk/downloads/dynamicweb-9

Kind Regards
Dynamicweb Care Support
Kristian Kirkholt

 

Votes for this answer: 1

 

You must be logged in to post in the forum