Skip to content

Commit 1ac3330

Browse files
MB-60029: New vector_index_optimized_for setting for vector fields
Comes with: * d11e8441 Aditi Ahuja | MB-60029: Accommodate vector_index_optimized_for into vector field mapping (#1959) And UI improvements. Change-Id: I47f45c190e7ef7e1d1ff8ca34073d0b914ff84b2 Reviewed-on: https://review.couchbase.org/c/cbft/+/203860 Well-Formed: Build Bot <[email protected]> Reviewed-by: Abhi Dangeti <[email protected]> Tested-by: Abhi Dangeti <[email protected]>
1 parent 8e3e2e1 commit 1ac3330

File tree

8 files changed

+52
-18
lines changed

8 files changed

+52
-18
lines changed

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ go 1.21
55
require (
66
github.com/aws/aws-sdk-go v1.48.1
77
github.com/blevesearch/bleve-mapping-ui v0.5.2
8-
github.com/blevesearch/bleve/v2 v2.3.11-0.20240116191004-a41da631b62d
9-
github.com/blevesearch/bleve_index_api v1.1.4
8+
github.com/blevesearch/bleve/v2 v2.3.11-0.20240117172029-d11e8441fa13
9+
github.com/blevesearch/bleve_index_api v1.1.5
1010
github.com/blevesearch/zapx/v11 v11.3.10
1111
github.com/blevesearch/zapx/v12 v12.3.10
1212
github.com/blevesearch/zapx/v13 v13.3.10
1313
github.com/blevesearch/zapx/v14 v14.3.10
1414
github.com/blevesearch/zapx/v15 v15.3.13
15-
github.com/blevesearch/zapx/v16 v16.0.1-0.20240112173957-c19e7ab032d8
15+
github.com/blevesearch/zapx/v16 v16.0.1-0.20240117165423-8662175b037b
1616
github.com/buger/jsonparser v1.1.1
1717
github.com/cloudfoundry/gosigar v1.3.4
1818
github.com/couchbase/cbauth v0.1.10
@@ -41,13 +41,13 @@ require (
4141
github.com/RoaringBitmap/roaring v1.2.3 // indirect
4242
github.com/beorn7/perks v1.0.1 // indirect
4343
github.com/bits-and-blooms/bitset v1.2.2 // indirect
44-
github.com/blevesearch/geo v0.1.18 // indirect
44+
github.com/blevesearch/geo v0.1.19 // indirect
4545
github.com/blevesearch/go-faiss v1.0.5 // indirect
4646
github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
4747
github.com/blevesearch/goleveldb v1.0.1 // indirect
4848
github.com/blevesearch/gtreap v0.1.1 // indirect
4949
github.com/blevesearch/mmap-go v1.0.4 // indirect
50-
github.com/blevesearch/scorch_segment_api/v2 v2.2.5 // indirect
50+
github.com/blevesearch/scorch_segment_api/v2 v2.2.6 // indirect
5151
github.com/blevesearch/segment v0.9.1 // indirect
5252
github.com/blevesearch/snowballstem v0.9.0 // indirect
5353
github.com/blevesearch/stempel v0.2.0 // indirect

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ github.com/bits-and-blooms/bitset v1.2.2 h1:J5gbX05GpMdBjCvQ9MteIg2KKDExr7DrgK+Y
5757
github.com/bits-and-blooms/bitset v1.2.2/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
5858
github.com/blevesearch/bleve-mapping-ui v0.5.2 h1:L6Irz3B14+L2WxIEVtkTi25Aps+uydKNAyt7IAlZOeE=
5959
github.com/blevesearch/bleve-mapping-ui v0.5.2/go.mod h1:D/HnjXhQdlSi0GU/xOWrh0LL/0XfmTSVuJZNQCy/Mqs=
60-
github.com/blevesearch/bleve/v2 v2.3.11-0.20240116191004-a41da631b62d h1:+XUuZpk8duqOjlc2ToSkTv9LdLcYaJuuNtBJAVvg/to=
61-
github.com/blevesearch/bleve/v2 v2.3.11-0.20240116191004-a41da631b62d/go.mod h1:RTR1BkzFoEZLBg8+dVPLOiBOMwfMQ8LnZ8/bE4RIjY8=
62-
github.com/blevesearch/bleve_index_api v1.1.4 h1:n9Ilxlb80g9DAhchR95IcVrzohamDSri0wPnkKnva50=
63-
github.com/blevesearch/bleve_index_api v1.1.4/go.mod h1:PbcwjIcRmjhGbkS/lJCpfgVSMROV6TRubGGAODaK1W8=
64-
github.com/blevesearch/geo v0.1.18 h1:Np8jycHTZ5scFe7VEPLrDoHnnb9C4j636ue/CGrhtDw=
65-
github.com/blevesearch/geo v0.1.18/go.mod h1:uRMGWG0HJYfWfFJpK3zTdnnr1K+ksZTuWKhXeSokfnM=
60+
github.com/blevesearch/bleve/v2 v2.3.11-0.20240117172029-d11e8441fa13 h1:QFKYhX0eEK1n59H9/eXzogKgDgNBxJW4y1VEMyMLhr0=
61+
github.com/blevesearch/bleve/v2 v2.3.11-0.20240117172029-d11e8441fa13/go.mod h1:FFHkVNhx9WALSdZFNdJc89avhTHYz9VFuMUiUMrFYEI=
62+
github.com/blevesearch/bleve_index_api v1.1.5 h1:0q05mzu6GT/kebzqKywCpou/eUea9wTKa7kfqX7QX+k=
63+
github.com/blevesearch/bleve_index_api v1.1.5/go.mod h1:PbcwjIcRmjhGbkS/lJCpfgVSMROV6TRubGGAODaK1W8=
64+
github.com/blevesearch/geo v0.1.19 h1:hlX1YpBZ+X+xfjS8hEpmM/tdPUFbqBME3mdAWKHo2s0=
65+
github.com/blevesearch/geo v0.1.19/go.mod h1:EPyr3iJCcESYa830PnkFhqzJkOP7/daHT/ocun43WRY=
6666
github.com/blevesearch/go-faiss v1.0.5 h1:IWlOZGF3GXFOUdLVW9JkqgWPQ3gEIYqqdp88rbrAcc4=
6767
github.com/blevesearch/go-faiss v1.0.5/go.mod h1:jrxHrbl42X/RnDPI+wBoZU8joxxuRwedrxqswQ3xfU8=
6868
github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo=
@@ -74,8 +74,8 @@ github.com/blevesearch/gtreap v0.1.1/go.mod h1:QaQyDRAT51sotthUWAH4Sj08awFSSWzgY
7474
github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA=
7575
github.com/blevesearch/mmap-go v1.0.4 h1:OVhDhT5B/M1HNPpYPBKIEJaD0F3Si+CrEKULGCDPWmc=
7676
github.com/blevesearch/mmap-go v1.0.4/go.mod h1:EWmEAOmdAS9z/pi/+Toxu99DnsbhG1TIxUoRmJw/pSs=
77-
github.com/blevesearch/scorch_segment_api/v2 v2.2.5 h1:5SsNQmR8v1bojtGQ1zFhZravcMg5rdiX8AVu6LwlVtc=
78-
github.com/blevesearch/scorch_segment_api/v2 v2.2.5/go.mod h1:8N2ytOlBCdurlxDgbqsfeR1oTKRN0ZVIKdUUP1VFZNc=
77+
github.com/blevesearch/scorch_segment_api/v2 v2.2.6 h1:rewrzgFaCEjjfWovAB9NubMAd4+aCLxD3RaQcPDaoNo=
78+
github.com/blevesearch/scorch_segment_api/v2 v2.2.6/go.mod h1:0rv+k/OIjtYCT/g7Z45pCOVweFyta+0AdXO8keKfZxo=
7979
github.com/blevesearch/segment v0.9.1 h1:+dThDy+Lvgj5JMxhmOVlgFfkUtZV2kw49xax4+jTfSU=
8080
github.com/blevesearch/segment v0.9.1/go.mod h1:zN21iLm7+GnBHWTao9I+Au/7MBiL8pPFtJBJTsk6kQw=
8181
github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s=
@@ -96,8 +96,8 @@ github.com/blevesearch/zapx/v14 v14.3.10 h1:SG6xlsL+W6YjhX5N3aEiL/2tcWh3DO75Bnz7
9696
github.com/blevesearch/zapx/v14 v14.3.10/go.mod h1:qqyuR0u230jN1yMmE4FIAuCxmahRQEOehF78m6oTgns=
9797
github.com/blevesearch/zapx/v15 v15.3.13 h1:6EkfaZiPlAxqXz0neniq35my6S48QI94W/wyhnpDHHQ=
9898
github.com/blevesearch/zapx/v15 v15.3.13/go.mod h1:Turk/TNRKj9es7ZpKK95PS7f6D44Y7fAFy8F4LXQtGg=
99-
github.com/blevesearch/zapx/v16 v16.0.1-0.20240112173957-c19e7ab032d8 h1:dJfTV12JRZ9zkAukNSmKRY8P9iGbETJt2SqW71AvkUM=
100-
github.com/blevesearch/zapx/v16 v16.0.1-0.20240112173957-c19e7ab032d8/go.mod h1:ih5Q8QhWQjgqVCnkSko/zMc5AR1BWyYbRyb/a+trB+Y=
99+
github.com/blevesearch/zapx/v16 v16.0.1-0.20240117165423-8662175b037b h1:jZs0UQurWmVaNlrNolROktccw36F/U/z7+AaNLrvwHU=
100+
github.com/blevesearch/zapx/v16 v16.0.1-0.20240117165423-8662175b037b/go.mod h1:FVQ8/6UMCPWFOJQ2sTJVju4d2XtTyPRhe1A6aQvNM5c=
101101
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
102102
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
103103
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=

ns_server_static/fts/fts.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,10 @@ function IndexNewCtrlFT_NS($scope, $http, $state, $stateParams,
17401740
if ("similarity" in value.fields[i]) {
17411741
mapping.similarity = value.fields[i].similarity
17421742
}
1743+
1744+
if ("vector_index_optimized_for" in value.fields[i]) {
1745+
mapping.vector_index_optimized_for = value.fields[i].vector_index_optimized_for
1746+
}
17431747
}
17441748

17451749
$scope.editAttrsDone(mapping, true)
@@ -2499,6 +2503,7 @@ function IndexNewCtrlFTEasy_NS($scope, $http, $state, $stateParams,
24992503
$scope.editField.date_format = "dateTimeOptional";
25002504
$scope.editField.dims = null;
25012505
$scope.editField.similarity = null;
2506+
$scope.editField.vector_index_optimized_for = null;
25022507
if (valType === "boolean") {
25032508
$scope.editField.type = "boolean";
25042509
} else if (valType === "number") {

ns_server_static/fts/fts_easy_field.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function newEditField() {
5757
} else if (this.type == "IP") {
5858
rv = "IP ";
5959
} else if (this.type == "vector") {
60-
rv = "vector (dims: " + this.dims + "; metric: " + this.similarity + ")";
60+
rv = "vector (dims: " + this.dims + "; metric: " + this.similarity + "; optimized for: " + this.vector_index_optimized_for + ")";
6161
}
6262

6363
var supporting = [];

ns_server_static/fts/fts_easy_mapping.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ function newEasyMapping() {
282282
if (field.similarity != null) {
283283
fieldMapping.similarity = field.similarity;
284284
}
285+
if (field.vector_index_optimized_for != null) {
286+
fieldMapping.vector_index_optimized_for = field.vector_index_optimized_for;
287+
}
285288
return fieldMapping;
286289
};
287290

@@ -380,6 +383,7 @@ function newEasyMapping() {
380383
editField.sortFacet = false;
381384
editField.dims = null;
382385
editField.similarity = null;
386+
editField.vector_index_optimized_for = null;
383387

384388
if (field.type == "text") {
385389
editField.type = "text";
@@ -418,14 +422,15 @@ function newEasyMapping() {
418422
if (field.docvalues) {
419423
editField.sortFacet = true;
420424
}
421-
422425
if (field.dims != null) {
423426
editField.dims = field.dims;
424427
}
425-
426428
if (field.similarity != null) {
427429
editField.similarity = field.similarity;
428430
}
431+
if (field.vector_index_optimized_for != null) {
432+
editField.vector_index_optimized_for = field.vector_index_optimized_for;
433+
}
429434

430435
mapping[editField.path] = editField;
431436
}

ns_server_static/fts/fts_new_easy.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,15 @@ <h4 class="margin-bottom-half" ng-if="!editField.new">Edit Fields</h4>
359359
</select>
360360
</div>
361361
</div>
362+
<div class="formrow">
363+
<label for="vector-index-optimized-for">Optimized For</label>
364+
<div class="row">
365+
<select ng-model="editField.vector_index_optimized_for">
366+
<option value="recall">recall</option>
367+
<option value="latency">latency</option>
368+
</select>
369+
</div>
370+
</div>
362371
</div>
363372
<div ng-if="field.type != 'disabled'" class="margin-bottom-1-5">
364373
<label for="searchable-as">Searchable As</label>

ns_server_static/fts/static-bleve-mapping/partials/mapping/type-mapping-tree.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
<span ng-if="field.docvalues">| docvalues</span>
188188
<span ng-if="field.dims">| dims: {{field.dims}}</span>
189189
<span ng-if="field.similarity">| metric: {{field.similarity}}</span>
190+
<span ng-if="field.vector_index_optimized_for">| vector index optimized for: {{field.vector_index_optimized_for}}</span>
190191
</span>
191192
</span>
192193
</span>
@@ -256,6 +257,15 @@
256257
</select>
257258
</label>
258259
</div>
260+
<div ng-if="field.type == 'vector'">
261+
<label>
262+
<span ng-class="{'invalid': field._invalid}">optimized for</span>
263+
<select ng-model="field.vector_index_optimized_for">
264+
<option value="recall">recall</option>
265+
<option value="latency">latency</option>
266+
</select>
267+
</label>
268+
</div>
259269
<div
260270
ng-if="field.type != 'disabled'"
261271
class="editAreaFieldCheckboxes">

ns_server_static/fts/static/util.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,11 @@ function blevePIndexInitController(initKind, indexParams, indexUI,
408408
delete rv.indexDef["sourceUUID"];
409409
}
410410

411+
// Drop "name" from the original and built index definition,
412+
// to account global vs scoped naming. Index name changes
413+
// are not allowed once created anyway.
414+
delete origIndexDef["name"];
415+
delete rv.indexDef["name"];
411416
if (angular.equals(origIndexDef, rv.indexDef)) {
412417
return false;
413418
}

0 commit comments

Comments
 (0)