November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi,
I think you need to add [SortableInSearchResult] attribute to your field and of course, rebuild your index.
Not entirely sure - I'll have to take a look at our code base, but that my best guess.
Regards,
/Q
Hi,
I tried what you suggested:
[Display( GroupName = SystemTabNames.Settings, Order = 100, Name = "Product Sort Order", Description = "The sort order value")] [Editable(true)] [DefaultValue(0)] [IncludeValuesInSearchResults] [Searchable] [SortableInSearchResults] public virtual int ProductSortOrder { get; set; }
However the order the products being returned is:
<ul> <li data-order="1">...</li> <li data-order="2">...</li> <li data-order="200">...</li> <li data-order="3">...</li> <li data-order="4">...</li> </ul>
rather than
<ul> <li data-order="1">...</li> <li data-order="2">...</li> <li data-order="3">...</li> <li data-order="4">...</li> <li data-order="200">...</li> </ul>
*note: data-order is the ProductSortOrder int value assigned to each product.
It is sorting as text. You could probably add type in your sorting field. Can you please share the code where you are adding Sorting object.
Create a SearchSort Field with type Numeric and add that in SearchOrder Object and use that. In theory this should work
Regards
/K
I don't think that you can create SearchSortField with type - only with name and if the sort should be descending or not.
I was able to reproduce the issue which OP has - and it looks like a missing feature/bug for me. I'll try to dig further when time permits.
Regards,
/Q
Hi, a bit late but we had a simular problem with sorting in Lucene. The problem seems to be that all properties are indexed as text (or that is what I saw when looking in the index using Luke). We solved it by inheriting from CatalogIndexbuilder and overriding the AddMetaField function. In there I append some leading zero's to certain numerical properties. That way the sorting works like:
00001
00002
00003
00020
etc.
We used this blog post as a reference. http://world.episerver.com/blogs/Lee-Crowe/Dates/2011/7/EPiCommerce-and-Multiline-Dictionary-Meta-Field-Bug/
Hi,
I've added a field to products for sorting in lucene based product search:
The code for building the search criteria includes setting the sort order like:
However, it seems to be sorting based on the string representation of the value so coming out as 1, 10, 4, and 5 rather than 1, 4, 5, 10.
Any ideas on how to fix this would be appreciated.