Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Search - order by expression

We would like to know, whether Azure Search makes possible undermentioned scenario.

Let us have an Azure Search index with three columns:

1.  Id [Edm.String]
2.  Tags [Collection(Edm.String)]
3.  MaxScore [Edm.Int32]

The index contains the following two entries:

Id  Tags                MaxScore
1   Paris,London,Rome   30
2   Paris               10

We have also a scoring profile and a scoring function of type Tag (Sum, Linear) which evaluate every tag by 10 points (boost = 10).

We want to search the records with tags "Paris, London" in this index and sort it according to the percentage of compliance, while 100% is the value in column MaxScore.

The problem is that by default Azure Search sorts records by score. So the results are following:

Id  Tags                MaxScore    Score     %
1   Paris,London,Rome   30          20        67%
2   Paris               10          10        100%

But we need to sort the records in descending order by the [%] column. It would be enough to makes possible Azure Search sorts records by expression. It would be something like $orderby=score*(100/MaxScore) in our case. However this is not currently possible.

Thank you.

like image 843
Keeble Avatar asked Oct 30 '22 01:10

Keeble


1 Answers

Azure Search does not support this scenario at this time. Please consider adding an item to our User Voice site for supporting expressions in $orderby. Also, please vote on this suggestion to support explicitly sorting by score in $orderby.

like image 137
Bruce Johnston Avatar answered Nov 11 '22 16:11

Bruce Johnston