-
Notifications
You must be signed in to change notification settings - Fork 533
Expand file tree
/
Copy pathLinqTranslationBaselineTests.TestRRFOrderByRankFunction.xml
More file actions
123 lines (123 loc) · 6.79 KB
/
LinqTranslationBaselineTests.TestRRFOrderByRankFunction.xml
File metadata and controls
123 lines (123 loc) · 6.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<Results>
<Result>
<Input>
<Description><![CDATA[RRF with 2 functions]]></Description>
<Expression><![CDATA[query.OrderByRank(doc => RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), doc.StringField2.FullTextScore(new [] {"test1", "test2", "test3"})})).Select(doc => doc.Pk)]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root["Pk"]
FROM root
ORDER BY RANK RRF(FullTextScore(root["StringField"], "test1"), FullTextScore(root["StringField2"], "test1", "test2", "test3"))]]></SqlQuery>
<Results><![CDATA[[
"Test",
"Test"
]]]></Results>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[RRF with 3 functions]]></Description>
<Expression><![CDATA[query.OrderByRank(doc => RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), doc.StringField.FullTextScore(new [] {"test1", "text2"}), doc.StringField2.FullTextScore(new [] {"test1", "test2", "test3"})})).Select(doc => doc.Pk)]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root["Pk"]
FROM root
ORDER BY RANK RRF(FullTextScore(root["StringField"], "test1"), FullTextScore(root["StringField"], "test1", "text2"), FullTextScore(root["StringField2"], "test1", "test2", "test3"))]]></SqlQuery>
<Results><![CDATA[[
"Test",
"Test"
]]]></Results>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[RRF with 1 function]]></Description>
<Expression><![CDATA[query.OrderByRank(doc => RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"})})).Select(doc => doc.Pk)]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root["Pk"]
FROM root
ORDER BY RANK RRF(FullTextScore(root["StringField"], "test1"))]]></SqlQuery>
<ErrorMessage><![CDATA[Status Code: BadRequest,{"errors":[{"severity":"Error","location":{"start":34,"end":96},"code":"SC2221","message":"The ORDER BY RANK clause must be followed by a VectorDistance and/or a FullTextScore function call."}]},0x800A0B00]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[RRF in WHERE clause]]></Description>
<Expression><![CDATA[query.Where(doc => (RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"})}) != 123))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root
FROM root
WHERE (RRF(FullTextScore(root["StringField"], "test1")) != 123)]]></SqlQuery>
<ErrorMessage><![CDATA[Status Code: BadRequest,{"errors":[{"severity":"Error","location":{"start":39,"end":82},"code":"SC2240","message":"The FullTextScore function is only allowed in the ORDER BY RANK clause."},{"severity":"Error","location":{"start":35,"end":38},"code":"SC2005","message":"'RRF' is not a recognized built-in function name."}]},0x800A0B00]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[RRF in WHERE clause 2]]></Description>
<Expression><![CDATA[query.Where(doc => (RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), doc.StringField2.FullTextScore(new [] {"test1", "test2", "test3"})}) != 123))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[
SELECT VALUE root
FROM root
WHERE (RRF(FullTextScore(root["StringField"], "test1"), FullTextScore(root["StringField2"], "test1", "test2", "test3")) != 123)]]></SqlQuery>
<ErrorMessage><![CDATA[Status Code: BadRequest,{"errors":[{"severity":"Error","location":{"start":39,"end":82},"code":"SC2240","message":"The FullTextScore function is only allowed in the ORDER BY RANK clause."},{"severity":"Error","location":{"start":84,"end":146},"code":"SC2240","message":"The FullTextScore function is only allowed in the ORDER BY RANK clause."},{"severity":"Error","location":{"start":35,"end":38},"code":"SC2005","message":"'RRF' is not a recognized built-in function name."}]},0x800A0B00]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[RRF with non scoring function]]></Description>
<Expression><![CDATA[query.OrderByRank(doc => RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), 123}))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[]]></SqlQuery>
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore, VectorDistance.]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[RRF with non scoring function 2]]></Description>
<Expression><![CDATA[query.OrderByRank(doc => RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), (doc.IntField * 1)}))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[]]></SqlQuery>
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore, VectorDistance.]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[RRF with non scoring function 3]]></Description>
<Expression><![CDATA[query.OrderByRank(doc => RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), Convert(doc.StringField2.Length, Double)}))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[]]></SqlQuery>
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore, VectorDistance.]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[RRF with non scoring function 4]]></Description>
<Expression><![CDATA[query.OrderByRank(doc => RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), Convert(doc.ArrayField.Count(), Double)}))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[]]></SqlQuery>
<ErrorMessage><![CDATA[Expressions of type System.Double is not supported as an argument to CosmosLinqExtensions.RRF. Supported expressions are method calls to FullTextScore, VectorDistance.]]></ErrorMessage>
</Output>
</Result>
<Result>
<Input>
<Description><![CDATA[RRF with RRF]]></Description>
<Expression><![CDATA[query.OrderByRank(doc => RRF(new [] {doc.StringField.FullTextScore(new [] {"test1"}), RRF(new [] {doc.StringField2.FullTextScore(new [] {"test1", "test2", "test3"}), doc.StringField.FullTextScore(new [] {"test1", "test2"})})}))]]></Expression>
</Input>
<Output>
<SqlQuery><![CDATA[]]></SqlQuery>
<ErrorMessage><![CDATA[Method RRF is not supported as an argument to CosmosLinqExtensions.RRF. Supported methods are FullTextScore, VectorDistance.]]></ErrorMessage>
</Output>
</Result>
</Results>