Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPLIB-1548 Inherit typeMap option in Collection::listSearchIndexes() #1482

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Oct 14, 2024

@GromNaN GromNaN requested a review from a team as a code owner October 14, 2024 14:30
@GromNaN GromNaN requested a review from jmikola October 14, 2024 14:30
@GromNaN GromNaN added the bug label Oct 14, 2024
@GromNaN GromNaN changed the base branch from v1.x to v1.20 October 14, 2024 14:30
@GromNaN GromNaN changed the base branch from v1.20 to v1.x October 14, 2024 14:30
@GromNaN GromNaN changed the title PHPLIB-1548 Inherit typeMap option in Collection::listSearchIndexes() PHPLIB-1548 Inherit typeMap option in Collection::listSearchIndexes() Oct 14, 2024
@GromNaN GromNaN merged commit 85e8502 into mongodb:v1.x Oct 15, 2024
29 checks passed
@GromNaN GromNaN deleted the PHPLIB-1548 branch October 15, 2024 09:59
$collection->insertOne(['_id' => 1]);

try {
$collection->createSearchIndex(['mappings' => ['dynamic' => false]], ['name' => 'test-search-index']);
Copy link
Member

@jmikola jmikola Oct 15, 2024

Choose a reason for hiding this comment

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

Does dynamic: false make sense here? Quoting createSearchIndexes command docs:

If set to false, you must specify individual fields to index using mappings.fields.

Presumably, this creates a search index that does nothing. I'm curious as to why the server would even allow that, but wonder if future validation might break this. dynamic: true seems more correct (if only as a valid demonstration).

Copy link
Member Author

@GromNaN GromNaN Oct 15, 2024

Choose a reason for hiding this comment

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

I used this mapping because it is in the spec test: https://github.com/mongodb/specifications/blob/b746fcc71ad7c1b376482852c3c9cbba4eed7d26/source/index-management/tests/README.md#case-1-driver-can-successfully-create-and-list-search-indexes

This requires a spec change if we want a client error in case of dynamic: false AND fields: empty

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for digging that up. Since spec test reads the definition back from the server, I think this goes beyond anything drivers should address themselves. I'll share a link to this thread with the Atlas Search team but OK to leave this PR as-is.

alcaeus added a commit that referenced this pull request Oct 16, 2024
* v1.x: (101 commits)
  PHPLIB-1541: Include specs repository as a submodule (#1429)
  PHPLIB-1548 Inherit `typeMap` option in `Collection::listSearchIndexes()` (#1482)
  Fix array shape for `Collection::listSearchIndex($options)` (#1480)
  PHPLIB-1545: Deprecate CreateCollection flags option and related constants (#1477)
  Fix junit logging (#1475)
  Deprecate typeMap on operations without meaningful result (#1473)
  PHPLIB-1369 Upgrade to PHPUnit 10 (#1412)
  Higher phpunit version required (#1463)
  Fix deprecations in tests (#1458)
  Deprecate functionality to be removed (#1441)
  Expect BulkWriteException (#1455)
  Merge v1.20 into v1.x (#1447)
  PHPLIB-1525 Removes dependency to Symfony PHPUnit bridge (#1413)
  Change deprecated assertObjectHasAttribute to assertObjectHasProperty (#1432)
  Performance: Keep collections and indexes between GridFS tests (#1421)
  Add final annotations to non-internal Operation classes (#1410)
  Fix types accepted by $round (#1401)
  Replace arrayHasKey with assertArrayHasKey in tests (#1403)
  PHPLIB-1514 Make data providers static (#1404)
  PHPLIB-1515 Replace assertObjectHasAttribute with assertObjectHasProperty (#1405)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants