Gravatar for andrew.harbert@nttdata.com

Question by adharbert, Nov 17, 2014 3:47 PM

Create computed field with multiple for multiple sorting options

My client wants to be able to sort products in order of 4 different fields. I was told there is a way to do this by creating a new computed fields that will take these 4 fields and allow for sorting by this new field.

Would anyone know how this is achieved?

1 Reply
Gravatar for vseguin@coveo.com

Answer by Vincent Séguin, Nov 17, 2014 4:03 PM

Hi Andrew,

I'm not sure of what you want to achieve exactly. Is it possible to describe it in more details?

Gravatar for andrew.harbert@nttdata.com

Comment by adharbert, Nov 17, 2014 4:12 PM

We have a product that has many fields. We currently have a sort on one fields. Was told there is a way to make a computed field that can take 4 fields and mark the product for sorting. So instead of order by. then order by.. etc, this computed fields can take care of that.

Gravatar for cbolduc@coveo.com

Comment by Carl Bolduc, Nov 17, 2014 4:58 PM

Do you need multi-sort server side (using LINQ) or client side (using the JavaScript Framework)?

Gravatar for dlavoie@coveo.com

Comment by Daniel Lavoie, Nov 18, 2014 10:00 AM

What you have been told is probably to use a Query Function, that will create a new numerical field with the four input fields (provided you can come up with a formula that makes sense).

A Computed Field is a computation added to a facet (for example, average of field Y for every facet value of field X), so it wouldn't be of much use here.

Ask a question