Skip to content

Commit e6209fa

Browse files
committed
Enabled the vectorScore test and merged it into the main vector test.
1 parent 2145c31 commit e6209fa

File tree

1 file changed

+4
-18
lines changed
  • marklogic-client-api/src/test/java/com/marklogic/client/test/rows

1 file changed

+4
-18
lines changed

marklogic-client-api/src/test/java/com/marklogic/client/test/rows/VectorTest.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.marklogic.client.type.XsDoubleSeqVal;
1010
import org.junit.jupiter.api.Assertions;
1111
import org.junit.jupiter.api.BeforeEach;
12-
import org.junit.jupiter.api.Disabled;
1312
import org.junit.jupiter.api.Test;
1413
import org.junit.jupiter.api.extension.ExtendWith;
1514

@@ -49,11 +48,12 @@ void vectorFunctionsHappyPath() {
4948
.bind(op.as("base64Encode", op.vec.base64Encode(op.col("sampleVector"))))
5049
.bind(op.as("base64Decode", op.vec.base64Decode(op.col("base64Encode"))))
5150
.bind(op.as("subVector", op.vec.subvector(op.col("sampleVector"), op.xs.integer(1), op.xs.integer(1))))
51+
.bind(op.as("vectorScore", op.vec.vectorScore(op.xs.unsignedInt(1), op.xs.doubleVal(0.5))))
5252
.select(
5353
op.col("cosineSimilarity"), op.col("dotProduct"), op.col("euclideanDistance"),
5454
op.col("name"), op.col("dimension"), op.col("normalize"),
5555
op.col("magnitude"), op.col("get"), op.col("add"), op.col("subtract"),
56-
op.col("base64Encode"), op.col("base64Decode"), op.col("subVector")
56+
op.col("base64Encode"), op.col("base64Decode"), op.col("subVector"), op.col("vectorScore")
5757
)
5858
.limit(5);
5959
List<RowRecord> rows = resultRows(plan);
@@ -77,6 +77,8 @@ void vectorFunctionsHappyPath() {
7777
assertEquals(3, ((ArrayNode) row.get("base64Decode")).size());
7878
assertEquals(5.6, row.getDouble("get"));
7979
assertEquals(1, ((ArrayNode) row.get("subVector")).size());
80+
double vectorScore = row.getDouble("vectorScore");
81+
assertTrue(vectorScore > 0, "Unexpected value: " + vectorScore);
8082
});
8183
}
8284

@@ -106,20 +108,4 @@ void cosineSimilarity_InvalidVector() {
106108
assertTrue(actualMessage.contains("arg2 is not of type vec:vector"), "Unexpected message: " + actualMessage);
107109
}
108110

109-
@Test
110-
@Disabled("See ticket MLE-15508")
111-
void vectorScore() {
112-
PlanBuilder.ModifyPlan plan =
113-
op.fromView("vectors", "persons")
114-
.bind(op.as("vectorScore", op.vec.vectorScore(op.xs.unsignedInt(1), op.xs.doubleVal(2))))
115-
.select(op.col("vectorScore"))
116-
.limit(5);
117-
List<RowRecord> rows = resultRows(plan);
118-
assertEquals(2, rows.size());
119-
rows.forEach(row -> {
120-
double vectorScore = row.getDouble("vectorScore");
121-
assertTrue(vectorScore > 0, "Unexpected value: " + vectorScore);
122-
});
123-
}
124-
125111
}

0 commit comments

Comments
 (0)