Skip to content

Commit f19e65e

Browse files
committed
MLE-15687 : Run auto-generation again to include server side code changes for 12-EA
1 parent 0b6548e commit f19e65e

File tree

8 files changed

+108
-66
lines changed

8 files changed

+108
-66
lines changed

marklogic-client-api/src/main/java/com/marklogic/client/expression/VecExpr.java

Lines changed: 54 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.marklogic.client.type.XsFloatVal;
2222
import com.marklogic.client.type.XsStringVal;
2323
import com.marklogic.client.type.XsUnsignedIntVal;
24+
import com.marklogic.client.type.XsUnsignedLongVal;
2425

2526
import com.marklogic.client.type.ServerExpression;
2627

@@ -31,9 +32,20 @@
3132
* pipeline.
3233
*/
3334
public interface VecExpr {
34-
public ServerExpression add(ServerExpression vector1, ServerExpression vector2);
35+
/**
36+
* Returns the sum of two vectors. The vectors must be of the same dimension.
37+
*
38+
* <a name="ml-server-type-add"></a>
39+
40+
* <p>
41+
* Provides a client interface to the <a href="http://docs.marklogic.com/vec:add" target="mlserverdoc">vec:add</a> server function.
42+
* @param vector1 The first addend vector. (of <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a>)
43+
* @param vector2 The second addend vector. (of <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a>)
44+
* @return a server expression with the <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a> server data type
45+
*/
46+
public ServerExpression add(ServerExpression vector1, ServerExpression vector2);
3547
/**
36-
* Constructs a vector result by decoding the base64 binary input.
48+
* Returns a vector value by decoding the base64 encoded string input.
3749
*
3850
* <a name="ml-server-type-base64-decode"></a>
3951
@@ -109,7 +121,7 @@ public interface VecExpr {
109121
* <p>
110122
* Provides a client interface to the <a href="http://docs.marklogic.com/vec:get" target="mlserverdoc">vec:get</a> server function.
111123
* @param vector1 The vector to grab the k-th element of. (of <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a>)
112-
* @param k The zero-based index of vector1 to return. (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
124+
* @param k The zero-based index of vector1 to return. If k is greater than the number of elements in the vector, throw VEC-OUTOFBOUNDS. (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
113125
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_float.html">xs:float</a> server data type
114126
*/
115127
public ServerExpression get(ServerExpression vector1, ServerExpression k);
@@ -135,17 +147,37 @@ public interface VecExpr {
135147
* @return a server expression with the <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a> server data type
136148
*/
137149
public ServerExpression normalize(ServerExpression vector1);
138-
public ServerExpression subtract(ServerExpression vector1, ServerExpression vector2);
139150
/**
140-
* Returns a subvector of the input vector, starting at the specified index and with the specified length.
151+
* Returns the difference of two vectors. The vectors must be of the same dimension.
152+
*
153+
* <a name="ml-server-type-subtract"></a>
154+
155+
* <p>
156+
* Provides a client interface to the <a href="http://docs.marklogic.com/vec:subtract" target="mlserverdoc">vec:subtract</a> server function.
157+
* @param vector1 The minuend vector. (of <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a>)
158+
* @param vector2 The subtrahend vector. (of <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a>)
159+
* @return a server expression with the <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a> server data type
160+
*/
161+
public ServerExpression subtract(ServerExpression vector1, ServerExpression vector2);
162+
/**
163+
* Returns a subvector of the input vector, starting at the specified index, with the specified length (optional).
141164
*
142165
* <a name="ml-server-type-subvector"></a>
143166
144167
* <p>
145168
* Provides a client interface to the <a href="http://docs.marklogic.com/vec:subvector" target="mlserverdoc">vec:subvector</a> server function.
146169
* @param vector The input vector. (of <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a>)
147-
* @param start The starting index of the subvector (inclusive). (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
148-
* @param length The length of the subvector. (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
170+
* @param start The zero-based index of the input vector from which to start (inclusive). (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
171+
* @return a server expression with the <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a> server data type
172+
*/
173+
public ServerExpression subvector(ServerExpression vector, ServerExpression start);
174+
/**
175+
* Returns a subvector of the input vector, starting at the specified index, with the specified length (optional).
176+
* <p>
177+
* Provides a client interface to the <a href="http://docs.marklogic.com/vec:subvector" target="mlserverdoc">vec:subvector</a> server function.
178+
* @param vector The input vector. (of <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a>)
179+
* @param start The zero-based index of the input vector from which to start (inclusive). (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
180+
* @param length The length of the subvector. If not provided, returns a subvector beginning from index at start to the end of the input vector. If length is greater than the number of elements left in the input vector, throw VEC-OUTOFBOUNDS. (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
149181
* @return a server expression with the <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a> server data type
150182
*/
151183
public ServerExpression subvector(ServerExpression vector, ServerExpression start, ServerExpression length);
@@ -156,49 +188,49 @@ public interface VecExpr {
156188
157189
* <p>
158190
* Provides a client interface to the <a href="http://docs.marklogic.com/vec:vector" target="mlserverdoc">vec:vector</a> server function.
159-
* @param values The values to create the vector from. Can be a sequence or json:array of integer or floating-point numbers. (of <a href="{@docRoot}/doc-files/types/xs_anyAtomicType.html">xs:anyAtomicType</a>)
191+
* @param values The value(s) to create the vector from. Can be a sequence or json:array of integer or floating-point numbers. Also accepts a string that has the format of a JSON array of Numbers. Also accepts a string that was created by vec:base64-encode(). (of <a href="{@docRoot}/doc-files/types/xs_anyAtomicType.html">xs:anyAtomicType</a>)
160192
* @return a server expression with the <a href="{@docRoot}/doc-files/types/vec_vector.html">vec:vector</a> server data type
161193
*/
162194
public ServerExpression vector(ServerExpression values);
163195
/**
164-
* A helper function that returns the hybrid score using a cts:score and a vector similarity function. You can tune the effect of the vector similarity on the score using the "similarity-weight" option.
196+
* A helper function that returns a hybrid score using a cts score and a vector similarity calculation result. You can tune the effect of the vector similarity on the score using the similarityWeight option. The ideal value for similarityWeight depends on your application.
165197
* <p>
166198
* Provides a client interface to the <a href="http://docs.marklogic.com/vec:vector-score" target="mlserverdoc">vec:vector-score</a> server function.
167199
* @param score The cts:score of the matching document. (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
168-
* @param similarity The similarity between the vector in the matching document and the query vector. The result of a call to ovec:cosine-similarity() or op.vec.cosineSimilarity(). In the case that the vectors are normalized, pass ovec:dot-product() or op.vec.dotProduct(). Note that vec:euclideanDistance() should not be used here. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
169-
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a> server data type
200+
* @param similarity The similarity between the vector in the matching document and the query vector. The result of a call to ovec:cosine-similarity(). In the case that the vectors are normalized, pass ovec:dot-product(). Note that vec:euclidean-distance() should not be used here. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
201+
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_unsignedLong.html">xs:unsignedLong</a> server data type
170202
*/
171203
public ServerExpression vectorScore(ServerExpression score, double similarity);
172204
/**
173-
* A helper function that returns the hybrid score using a cts:score and a vector similarity function. You can tune the effect of the vector similarity on the score using the "similarity-weight" option.
205+
* A helper function that returns a hybrid score using a cts score and a vector similarity calculation result. You can tune the effect of the vector similarity on the score using the similarityWeight option. The ideal value for similarityWeight depends on your application.
174206
*
175207
* <a name="ml-server-type-vector-score"></a>
176208
177209
* <p>
178210
* Provides a client interface to the <a href="http://docs.marklogic.com/vec:vector-score" target="mlserverdoc">vec:vector-score</a> server function.
179211
* @param score The cts:score of the matching document. (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
180-
* @param similarity The similarity between the vector in the matching document and the query vector. The result of a call to ovec:cosine-similarity() or op.vec.cosineSimilarity(). In the case that the vectors are normalized, pass ovec:dot-product() or op.vec.dotProduct(). Note that vec:euclideanDistance() should not be used here. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
181-
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a> server data type
212+
* @param similarity The similarity between the vector in the matching document and the query vector. The result of a call to ovec:cosine-similarity(). In the case that the vectors are normalized, pass ovec:dot-product(). Note that vec:euclidean-distance() should not be used here. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
213+
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_unsignedLong.html">xs:unsignedLong</a> server data type
182214
*/
183215
public ServerExpression vectorScore(ServerExpression score, ServerExpression similarity);
184216
/**
185-
* A helper function that returns the hybrid score using a cts:score and a vector similarity function. You can tune the effect of the vector similarity on the score using the "similarity-weight" option.
217+
* A helper function that returns a hybrid score using a cts score and a vector similarity calculation result. You can tune the effect of the vector similarity on the score using the similarityWeight option. The ideal value for similarityWeight depends on your application.
186218
* <p>
187219
* Provides a client interface to the <a href="http://docs.marklogic.com/vec:vector-score" target="mlserverdoc">vec:vector-score</a> server function.
188220
* @param score The cts:score of the matching document. (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
189-
* @param similarity The similarity between the vector in the matching document and the query vector. The result of a call to ovec:cosine-similarity() or op.vec.cosineSimilarity(). In the case that the vectors are normalized, pass ovec:dot-product() or op.vec.dotProduct(). Note that vec:euclideanDistance() should not be used here. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
190-
* @param similarityWeight The weight of the vector similarity on the score. The default value is 1.0. Values less than or equal to zero have no effect. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
191-
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a> server data type
221+
* @param similarity The similarity between the vector in the matching document and the query vector. The result of a call to ovec:cosine-similarity(). In the case that the vectors are normalized, pass ovec:dot-product(). Note that vec:euclidean-distance() should not be used here. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
222+
* @param similarityWeight The weight of the vector similarity on the score. The default value is 0.1. If 0.0 is passed in, vector similarity has no effect. If passed a value less than 0.0 or greater than 1.0, throw VEC-VECTORSCORE. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
223+
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_unsignedLong.html">xs:unsignedLong</a> server data type
192224
*/
193225
public ServerExpression vectorScore(ServerExpression score, double similarity, double similarityWeight);
194226
/**
195-
* A helper function that returns the hybrid score using a cts:score and a vector similarity function. You can tune the effect of the vector similarity on the score using the "similarity-weight" option.
227+
* A helper function that returns a hybrid score using a cts score and a vector similarity calculation result. You can tune the effect of the vector similarity on the score using the similarityWeight option. The ideal value for similarityWeight depends on your application.
196228
* <p>
197229
* Provides a client interface to the <a href="http://docs.marklogic.com/vec:vector-score" target="mlserverdoc">vec:vector-score</a> server function.
198230
* @param score The cts:score of the matching document. (of <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a>)
199-
* @param similarity The similarity between the vector in the matching document and the query vector. The result of a call to ovec:cosine-similarity() or op.vec.cosineSimilarity(). In the case that the vectors are normalized, pass ovec:dot-product() or op.vec.dotProduct(). Note that vec:euclideanDistance() should not be used here. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
200-
* @param similarityWeight The weight of the vector similarity on the score. The default value is 1.0. Values less than or equal to zero have no effect. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
201-
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_unsignedInt.html">xs:unsignedInt</a> server data type
231+
* @param similarity The similarity between the vector in the matching document and the query vector. The result of a call to ovec:cosine-similarity(). In the case that the vectors are normalized, pass ovec:dot-product(). Note that vec:euclidean-distance() should not be used here. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
232+
* @param similarityWeight The weight of the vector similarity on the score. The default value is 0.1. If 0.0 is passed in, vector similarity has no effect. If passed a value less than 0.0 or greater than 1.0, throw VEC-VECTORSCORE. (of <a href="{@docRoot}/doc-files/types/xs_double.html">xs:double</a>)
233+
* @return a server expression with the <a href="{@docRoot}/doc-files/types/xs_unsignedLong.html">xs:unsignedLong</a> server data type
202234
*/
203235
public ServerExpression vectorScore(ServerExpression score, ServerExpression similarity, ServerExpression similarityWeight);
204236
}

marklogic-client-api/src/main/java/com/marklogic/client/impl/VecExprImpl.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.marklogic.client.type.XsFloatVal;
2222
import com.marklogic.client.type.XsStringVal;
2323
import com.marklogic.client.type.XsUnsignedIntVal;
24+
import com.marklogic.client.type.XsUnsignedLongVal;
2425

2526
import com.marklogic.client.type.ServerExpression;
2627

@@ -156,15 +157,24 @@ public ServerExpression subtract(ServerExpression vector1, ServerExpression vect
156157

157158

158159
@Override
159-
public ServerExpression subvector(ServerExpression vector, ServerExpression start, ServerExpression length) {
160+
public ServerExpression subvector(ServerExpression vector, ServerExpression start) {
160161
if (vector == null) {
161162
throw new IllegalArgumentException("vector parameter for subvector() cannot be null");
162163
}
163164
if (start == null) {
164165
throw new IllegalArgumentException("start parameter for subvector() cannot be null");
165166
}
166-
if (length == null) {
167-
throw new IllegalArgumentException("length parameter for subvector() cannot be null");
167+
return new VectorCallImpl("vec", "subvector", new Object[]{ vector, start });
168+
}
169+
170+
171+
@Override
172+
public ServerExpression subvector(ServerExpression vector, ServerExpression start, ServerExpression length) {
173+
if (vector == null) {
174+
throw new IllegalArgumentException("vector parameter for subvector() cannot be null");
175+
}
176+
if (start == null) {
177+
throw new IllegalArgumentException("start parameter for subvector() cannot be null");
168178
}
169179
return new VectorCallImpl("vec", "subvector", new Object[]{ vector, start, length });
170180
}
@@ -190,7 +200,7 @@ public ServerExpression vectorScore(ServerExpression score, ServerExpression sim
190200
if (similarity == null) {
191201
throw new IllegalArgumentException("similarity parameter for vectorScore() cannot be null");
192202
}
193-
return new XsExprImpl.UnsignedIntCallImpl("vec", "vector-score", new Object[]{ score, similarity });
203+
return new XsExprImpl.UnsignedLongCallImpl("vec", "vector-score", new Object[]{ score, similarity });
194204
}
195205

196206

@@ -208,7 +218,7 @@ public ServerExpression vectorScore(ServerExpression score, ServerExpression sim
208218
if (similarity == null) {
209219
throw new IllegalArgumentException("similarity parameter for vectorScore() cannot be null");
210220
}
211-
return new XsExprImpl.UnsignedIntCallImpl("vec", "vector-score", new Object[]{ score, similarity, similarityWeight });
221+
return new XsExprImpl.UnsignedLongCallImpl("vec", "vector-score", new Object[]{ score, similarity, similarityWeight });
212222
}
213223

214224
static class VectorSeqCallImpl extends BaseTypeImpl.ServerExpressionCallImpl {

marklogic-client-api/src/main/javadoc/doc-files/types/vec_vector.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</tr>
8080
<tr class="altColor">
8181
<td class="colFirst">vec:vector</td>
82-
<td class="colLast"><span class="memberNameLink">vec:subvector</span>(<span>vec:vector <i>vector</i></span>, <span><a href="xs_unsignedInt.html">xs:unsignedInt</a> <i>start</i></span>, <span><a href="xs_unsignedInt.html">xs:unsignedInt</a> <i>length</i></span>)</td>
82+
<td class="colLast"><span class="memberNameLink">vec:subvector</span>(<span>vec:vector <i>vector</i></span>, <span><a href="xs_unsignedInt.html">xs:unsignedInt</a> <i>start</i></span>, <span><a href="xs_unsignedInt.html">xs:unsignedInt</a> <i>length</i>?</span>)</td>
8383
<td><a href="../../com/marklogic/client/expression/VecExpr.html#ml-server-type-subvector">java</a></td>
8484
<td><a href="http://docs.marklogic.com/vec:subvector" target="mlserverdoc">server</a></td>
8585
</tr>
@@ -115,7 +115,7 @@
115115
</tr>
116116
<tr class="altColor">
117117
<td class="colFirst">vec:vector</td>
118-
<td class="colLast"><span class="memberNameLink">vec:subvector</span>(<span>vec:vector <i>vector</i></span>, <span><a href="xs_unsignedInt.html">xs:unsignedInt</a> <i>start</i></span>, <span><a href="xs_unsignedInt.html">xs:unsignedInt</a> <i>length</i></span>)</td>
118+
<td class="colLast"><span class="memberNameLink">vec:subvector</span>(<span>vec:vector <i>vector</i></span>, <span><a href="xs_unsignedInt.html">xs:unsignedInt</a> <i>start</i></span>, <span><a href="xs_unsignedInt.html">xs:unsignedInt</a> <i>length</i>?</span>)</td>
119119
<td><a href="../../com/marklogic/client/expression/VecExpr.html#ml-server-type-subvector">java</a></td>
120120
<td><a href="http://docs.marklogic.com/vec:subvector" target="mlserverdoc">server</a></td>
121121
</tr>

marklogic-client-api/src/main/javadoc/doc-files/types/xs_anyAtomicType.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@
476476
<td><a href="http://docs.marklogic.com/xs:yearMonthDuration" target="mlserverdoc">server</a></td>
477477
</tr>
478478
<tr class="altColor">
479-
<td class="colFirst"><a href="vec_vector.html">vec:vector</a></td>
479+
<td class="colFirst"><a href="vec_vector.html">vec:vector</a>?</td>
480480
<td class="colLast"><span class="memberNameLink">vec:vector</span>(<span>xs:anyAtomicType <i>values</i>*</span>)</td>
481481
<td><a href="../../com/marklogic/client/expression/VecExpr.html#ml-server-type-vector">java</a></td>
482482
<td><a href="http://docs.marklogic.com/vec:vector" target="mlserverdoc">server</a></td>

0 commit comments

Comments
 (0)