Skip to content

refactor: dev to main - Improve search index deletion logic and handling#937

Merged
Roopan-Microsoft merged 6 commits into
mainfrom
dev
Jun 1, 2026
Merged

refactor: dev to main - Improve search index deletion logic and handling#937
Roopan-Microsoft merged 6 commits into
mainfrom
dev

Conversation

@Pavan-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request updates the 01_create_search_index.py script to improve how search indexes are managed during creation. The main changes ensure that any existing index is deleted before a new one is created, and the index creation method is simplified for better reliability.

Index management improvements:

  • The script now attempts to delete the existing search index (INDEX_NAME) before creating a new one, ensuring a clean state and preventing conflicts. If the index does not exist, the script safely ignores the error.
  • Added an import for ResourceNotFoundError from azure.core.exceptions to handle cases where the index to be deleted does not exist.

Index creation simplification:

  • Replaced create_or_update_index with create_index to ensure that a new index is always created after deletion, avoiding accidental updates to an existing index.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

Comment thread infra/scripts/index_scripts/01_create_search_index.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors the Azure Cognitive Search index creation script to ensure a clean index state by deleting any existing index before creating a new one, and by using a dedicated create call rather than update semantics.

Changes:

  • Add ResourceNotFoundError handling to safely ignore “index not found” during deletion.
  • Delete the existing index (if present) before creating the new index definition.
  • Replace create_or_update_index with create_index to enforce fresh index creation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread infra/scripts/index_scripts/01_create_search_index.py
@Roopan-Microsoft Roopan-Microsoft merged commit 1856971 into main Jun 1, 2026
15 checks passed
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.23.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

github-actions Bot pushed a commit that referenced this pull request Jun 3, 2026
refactor: dev to main - Improve search index deletion logic and handling
github-actions Bot pushed a commit that referenced this pull request Jun 4, 2026
refactor: dev to main - Improve search index deletion logic and handling
github-actions Bot pushed a commit that referenced this pull request Jun 4, 2026
refactor: dev to main - Improve search index deletion logic and handling
github-actions Bot pushed a commit that referenced this pull request Jun 6, 2026
refactor: dev to main - Improve search index deletion logic and handling
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.

5 participants