I want to search some string in my column and i want to return the data in the order of index where they are found. Something like this:
SELECT c.myData INDEX_OF(c.myData , "ABC") AS Ordered FROM c WHERE INDEX_OF(c.searchablePartNum, "ABC") >= 0 ORDER BY c.Ordered```
This returns the result but it does not sort the result based on the output of the INDEX_OF, what am i missing here?
ORDER BY is applicable only on property or expression. In the query it is applied on
Orderedwhich is computed at runtime only. Therefore create computed property using.NET SDK V3orJava SDK V4and apply order by on that computed property only.Below is the computed property:
Before you can ORDER BY
abcIndexyou must add it to your indexing policy. After your indexing policy is updated, you can order by the computed property.For more information on ORDER BY refer this link.