Skip to content

Commit 3d5152c

Browse files
committed
Feedback.
1 parent 0ed29a8 commit 3d5152c

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/MongoDB.Driver/CreateSearchIndexModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace MongoDB.Driver
2020
{
2121
/// <summary>
2222
/// Defines a search index model using a <see cref="BsonDocument"/> definition. Consider using
23-
/// <see cref="CreateVectorIndexModel{TDocument}"/> to build vector indexes without specifying the BSON directly.
23+
/// <see cref="CreateVectorSearchIndexModel{TDocument}"/> to build vector indexes without specifying the BSON directly.
2424
/// </summary>
2525
public class CreateSearchIndexModel
2626
{
@@ -49,7 +49,7 @@ public BsonDocument Definition
4949
/// model as a <see cref="BsonDocument"/>.
5050
/// </summary>
5151
/// <remarks>
52-
/// Consider using <see cref="CreateVectorIndexModel{TDocument}"/> to build vector indexes without specifying
52+
/// Consider using <see cref="CreateVectorSearchIndexModel{TDocument}"/> to build vector indexes without specifying
5353
/// the BSON directly.
5454
/// </remarks>
5555
/// <param name="name">The index name.</param>
@@ -64,7 +64,7 @@ public CreateSearchIndexModel(string name, BsonDocument definition)
6464
/// model as a <see cref="BsonDocument"/>.
6565
/// </summary>
6666
/// <remarks>
67-
/// Consider using <see cref="CreateVectorIndexModel{TDocument}"/> to build vector indexes without specifying
67+
/// Consider using <see cref="CreateVectorSearchIndexModel{TDocument}"/> to build vector indexes without specifying
6868
/// the BSON directly.
6969
/// </remarks>
7070
/// <param name="name">The index name.</param>

src/MongoDB.Driver/CreateVectorIndexModel.cs renamed to src/MongoDB.Driver/CreateVectorSearchIndexModel.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace MongoDB.Driver;
2424
/// <summary>
2525
/// Defines a vector index model using strongly-typed C# APIs.
2626
/// </summary>
27-
public sealed class CreateVectorIndexModel<TDocument> : CreateSearchIndexModel
27+
public sealed class CreateVectorSearchIndexModel<TDocument> : CreateSearchIndexModel
2828
{
2929
/// <summary>
3030
/// The field containing the vectors to index.
@@ -62,15 +62,15 @@ public sealed class CreateVectorIndexModel<TDocument> : CreateSearchIndexModel
6262
public int? HnswNumEdgeCandidates { get; init; }
6363

6464
/// <summary>
65-
/// Initializes a new instance of the <see cref="CreateVectorIndexModel{TDocument}"/> class, passing the
65+
/// Initializes a new instance of the <see cref="CreateVectorSearchIndexModel{TDocument}"/> class, passing the
6666
/// required options for <see cref="VectorSimilarity"/> and the number of vector dimensions to the constructor.
6767
/// </summary>
6868
/// <param name="name">The index name.</param>
6969
/// <param name="field">The field containing the vectors to index.</param>
7070
/// <param name="similarity">The <see cref="VectorSimilarity"/> to use to search for top K-nearest neighbors.</param>
7171
/// <param name="dimensions">Number of vector dimensions that vector search enforces at index-time and query-time.</param>
7272
/// <param name="filterFields">Fields that may be used as filters in the vector query.</param>
73-
public CreateVectorIndexModel(
73+
public CreateVectorSearchIndexModel(
7474
FieldDefinition<TDocument> field,
7575
string name,
7676
VectorSimilarity similarity,
@@ -85,15 +85,15 @@ public CreateVectorIndexModel(
8585
}
8686

8787
/// <summary>
88-
/// Initializes a new instance of the <see cref="CreateVectorIndexModel{TDocument}"/> class, passing the
88+
/// Initializes a new instance of the <see cref="CreateVectorSearchIndexModel{TDocument}"/> class, passing the
8989
/// required options for <see cref="VectorSimilarity"/> and the number of vector dimensions to the constructor.
9090
/// </summary>
9191
/// <param name="name">The index name.</param>
9292
/// <param name="field">An expression pointing to the field containing the vectors to index.</param>
9393
/// <param name="similarity">The <see cref="VectorSimilarity"/> to use to search for top K-nearest neighbors.</param>
9494
/// <param name="dimensions">Number of vector dimensions that vector search enforces at index-time and query-time.</param>
9595
/// <param name="filterFields">Expressions pointing to fields that may be used as filters in the vector query.</param>
96-
public CreateVectorIndexModel(
96+
public CreateVectorSearchIndexModel(
9797
Expression<Func<TDocument, object>> field,
9898
string name,
9999
VectorSimilarity similarity,
@@ -160,6 +160,6 @@ public BsonDocument Render(RenderArgs<TDocument> renderArgs)
160160
}
161161
}
162162

163-
return new BsonDocument { { "fields", BsonArray.Create(fieldDocuments) } };
163+
return new BsonDocument { { "fields", new BsonArray(fieldDocuments) } };
164164
}
165165
}

src/MongoDB.Driver/MongoCollectionImpl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,8 +1752,8 @@ private CreateSearchIndexesOperation CreateCreateIndexesOperation(
17521752
=> new CreateSearchIndexRequest(
17531753
model.Name,
17541754
model.Type,
1755-
model is CreateVectorIndexModel<TDocument> createVectorIndexModel
1756-
? createVectorIndexModel.Render(renderArgs)
1755+
model is CreateVectorSearchIndexModel<TDocument> createVectorSearchIndexModel
1756+
? createVectorSearchIndexModel.Render(renderArgs)
17571757
: model.Definition)),
17581758
_collection._messageEncoderSettings);
17591759
}

tests/MongoDB.Driver.Tests/Search/AtlasSearchIndexManagmentTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public async Task Can_create_Atlas_vector_index_for_all_options_using_typed_API(
259259
{
260260
var indexName = async ? "test-index-vector-optional-async" : "test-index-vector-optional";
261261

262-
var indexModel = new CreateVectorIndexModel<EntityWithVector>(
262+
var indexModel = new CreateVectorSearchIndexModel<EntityWithVector>(
263263
e => e.Floats, indexName, VectorSimilarity.Cosine, dimensions: 2)
264264
{
265265
HnswMaxEdges = 18, HnswNumEdgeCandidates = 102, Quantization = VectorQuantization.Scalar
@@ -295,7 +295,7 @@ public async Task Can_create_Atlas_vector_index_for_required_only_options_using_
295295
{
296296
var indexName = async ? "test-index-vector-required-async" : "test-index-vector-required";
297297

298-
var indexModel = new CreateVectorIndexModel<EntityWithVector>("vectors", indexName, VectorSimilarity.Euclidean, dimensions: 4);
298+
var indexModel = new CreateVectorSearchIndexModel<EntityWithVector>("vectors", indexName, VectorSimilarity.Euclidean, dimensions: 4);
299299

300300
var collection = _database.GetCollection<EntityWithVector>(_collection.CollectionNamespace.CollectionName);
301301
var createdName = async
@@ -327,7 +327,7 @@ public async Task Can_create_Atlas_vector_index_for_all_options_using_typed_API_
327327
{
328328
var indexName = async ? "test-index-vector-typed-filters-async" : "test-index-typed-filters";
329329

330-
var indexModel = new CreateVectorIndexModel<EntityWithVector>(
330+
var indexModel = new CreateVectorSearchIndexModel<EntityWithVector>(
331331
e => e.Floats,
332332
indexName,
333333
VectorSimilarity.Cosine,
@@ -376,7 +376,7 @@ public async Task Can_create_Atlas_vector_index_for_required_only_options_using_
376376
{
377377
var indexName = async ? "test-index-untyped-filters-async" : "test-index-untyped-filters";
378378

379-
var indexModel = new CreateVectorIndexModel<EntityWithVector>(
379+
var indexModel = new CreateVectorSearchIndexModel<EntityWithVector>(
380380
"vectors",
381381
indexName,
382382
VectorSimilarity.Euclidean,

0 commit comments

Comments
 (0)