Skip to content

feat(model): add Model.createSearchIndexes() #15470

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

Merged
merged 2 commits into from
Jun 10, 2025
Merged

Conversation

vkarpov15
Copy link
Collaborator

@vkarpov15 vkarpov15 commented Jun 9, 2025

Fix #15465

Summary

Moved logic for auto creating search indexes into Model.createSearchIndexes().

Examples

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new API, Model.createSearchIndexes(), to consolidate and simplify search index creation logic and moves the auto-index creation from Model.init() into a dedicated helper function. Key changes include:

  • Refactoring Model.init() to call ensureSearchIndexes().
  • Implementing a new Model.createSearchIndexes() public API with a clear doc block.
  • Adjusting tests in test/model.test.js to validate the new API behavior.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/model.test.js Updated test to use the new createSearchIndexes() API and require reordering adjustments.
lib/model.js Refactored Model.init() call and introduced the createSearchIndexes() function with documentation.
Comments suppressed due to low confidence (1)

test/model.test.js:8691

  • [nitpick] A duplicate require for sinon is present in this test case even though sinon is already imported earlier in the file. Consider removing the redundant require to improve code clarity.
const sinon = require('sinon');

Copy link
Collaborator

@AbdelrahmanHafez AbdelrahmanHafez left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@vkarpov15 vkarpov15 merged commit 0770672 into 8.16 Jun 10, 2025
41 checks passed
@vkarpov15 vkarpov15 added this to the 8.16 milestone Jun 10, 2025
@AbdelrahmanHafez AbdelrahmanHafez deleted the vkarpov15/gh-15465 branch June 10, 2025 18:22
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.

3 participants