Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion infra/scripts/index_scripts/01_create_search_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
VectorSearch,
VectorSearchProfile,
)
from azure.core.exceptions import ResourceNotFoundError

# Get parameters from command line
p = argparse.ArgumentParser()
Expand Down Expand Up @@ -94,6 +95,13 @@ def create_search_index():
# Create the semantic settings with the configuration
semantic_search = SemanticSearch(configurations=[semantic_config])

# Delete the index if it already exists
try:
index_client.delete_index(INDEX_NAME)
print(f"✗ Existing search index '{INDEX_NAME}' deleted")
except ResourceNotFoundError:
Comment thread
github-code-quality[bot] marked this conversation as resolved.
Fixed
print(f"- Search index '{INDEX_NAME}' not found; skipping delete")
Comment thread
Pavan-Microsoft marked this conversation as resolved.

# Define and create the index
index = SearchIndex(
name=INDEX_NAME,
Expand All @@ -102,7 +110,7 @@ def create_search_index():
semantic_search=semantic_search
)

result = index_client.create_or_update_index(index)
result = index_client.create_index(index)
print(f"✓ Search index '{result.name}' created")


Expand Down
Loading