Skip to content

Conversation

@NoahStapp
Copy link
Contributor

DRIVERS-2768

Please complete the following before merging:

  • Update changelog.
  • Make sure there are generated JSON files from the YAML test files.
  • Test changes in at least one language driver.
  • Test these changes against all server versions and topologies (including standalone, replica set, sharded
    clusters, and serverless).

@NoahStapp NoahStapp requested a review from blink1073 March 6, 2024 22:06
@NoahStapp NoahStapp requested a review from a team as a code owner March 6, 2024 22:06
*/
name: String;
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: we just switched this spec to Markdown, so you'll have to move these changes to that file.


#. Assert that ``index`` has a property ``latestDefinition`` whose value is ``{ 'mappings': { 'dynamic': false } }``

Case 7: Driver can successfully handle search index types when creating indexes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the README file (actually I should have removed it in #1537)

@blink1073
Copy link
Member

Can you also add new spec tests that use type:vector to ensure they fail in a non-Atlas environment?

@blink1073
Copy link
Member

We should also either update one of the existing prose tests or add a new one that explicitly uses type: search.

@NoahStapp
Copy link
Contributor Author

We should also either update one of the existing prose tests or add a new one that explicitly uses type: search.

The new prose test does explicitly create an index using type: search.

@NoahStapp
Copy link
Contributor Author

Can you also add new spec tests that use type:vector to ensure they fail in a non-Atlas environment?

The existing spec tests aren't run against an Atlas cluster, they're used as unit tests to verify the driver sends the correct command document. They expect an error telling the user to use Atlas for search support. I'm not sure adding more of the same tests that have the vectorSearch type makes sense in that context.

@blink1073
Copy link
Member

I'm not sure adding more of the same tests that have the vectorSearch type makes sense in that context.

Perhaps just one extra test to make sure the field is handled appropriately?


- An index with the ``name`` of ``test-search-index-case7-implicit`` is present and the index has a field ``queryable`` with a value of ``true``.

5. Assert that ``index1`` has a property ``type`` whose value is ``search``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
5. Assert that ``index1`` has a property ``type`` whose value is ``search``
5. Assert that ``index1`` has a property ``type`` whose value is ``search``.


- An index with the ``name`` of ``test-search-index-case7-explicit`` is present and the index has a field ``queryable`` with a value of ``true``.

9. Assert that ``index2`` has a property ``type`` whose value is ``search``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
9. Assert that ``index2`` has a property ``type`` whose value is ``search``
9. Assert that ``index2`` has a property ``type`` whose value is ``search``.


- An index with the ``name`` of ``test-search-index-case7-vector`` is present and the index has a field ``queryable`` with a value of ``true``.

13. Assert that ``index3`` has a property ``type`` whose value is ``vectorSearch``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
13. Assert that ``index3`` has a property ``type`` whose value is ``vectorSearch``
13. Assert that ``index3`` has a property ``type`` whose value is ``vectorSearch``.

]
},
{
"description": "create a vector search index",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is not in the yml file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed!

@blink1073
Copy link
Member

Can you please install and run pre-commit run --all-files locally?

@NoahStapp NoahStapp requested a review from blink1073 March 11, 2024 16:32
Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Let's hold off on merging until the first two implementations are done.

name: String;

/**
* Optionally specify a type for the index. Defaults to "search" if not provided.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many other driver options are implemented such that we only send a value if the user explicitly provides one. How do you feel about mandating that driver MUST NOT send this field if not provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me if that's a consistent pattern among drivers. The server should default to search implicitly if type is not provided, so the behavior is consistent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this change be made to the CreateSearchIndexOptions instead of IndexOptions? https://github.com/mongodb/specifications/blob/master/source/index-management/index-management.md#common-interfaces

Copy link
Contributor Author

@NoahStapp NoahStapp Mar 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateSearchIndexOptions is currently unused. If drivers support adding type to IndexOptions, that seems to be a better fit as then the top-level fields of type and name are present in the same interface.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, looking more closely it probably belongs in the SearchIndexModel?

IndexOptions is used for regular indexes, not search indexes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch! Yes, SearchIndexModel seems like the correct place for type.

name: String;

/**
* Optionally specify a type for the index. Defaults to "search" if not provided.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this change be made to the CreateSearchIndexOptions instead of IndexOptions? https://github.com/mongodb/specifications/blob/master/source/index-management/index-management.md#common-interfaces

Copy link
Contributor

@baileympearson baileympearson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POC passing in Node: mongodb/node-mongodb-native#4060

@NoahStapp NoahStapp merged commit b746fcc into mongodb:master Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants