Skip to content

Python: Use storage_name for hybrid search fields and vector queries (#14684) - #14688

Open
Abhinav Maurya (Fire162) wants to merge 2 commits into
microsoft:mainfrom
Fire162:fix/azure-ai-search-hybrid-storage-names
Open

Abhinav Maurya (Fire162) wants to merge 2 commits into
microsoft:mainfrom
Fire162:fix/azure-ai-search-hybrid-storage-names

Conversation

@Fire162

Copy link
Copy Markdown
Contributor

Motivation and Context

Fixes #14684.

When fields declare a storage_name alias, ensure_collection_exists creates index fields with their storage names, and search(SearchType.VECTOR) queries them via storage_name or name. However, hybrid_search() emitted declared property names (field.name), causing Azure AI Search to reject hybrid queries referencing unindexed field names (400 unknown field).

Description

  • Update AzureAISearchCollection in the SearchType.KEYWORD_HYBRID branch to use field.storage_name or field.name for search_fields and vector_field.storage_name or vector_field.name for vector queries, aligning with the index schema and the vector search branch.
  • Map options.additional_property_name to its storage name alias when it matches a configured field.
  • Added unit tests in tests/unit/connectors/memory/test_azure_ai_search.py verifying storage names are emitted for both default and custom search_fields and vector queries in hybrid search.

Contribution Checklist

Copilot AI balanced review requested due to automatic review settings October 29, 2026 19:48
@Fire162
Abhinav Maurya (Fire162) requested a review from a team as a code owner October 29, 2026 19:48
@semantic-kernel-automation semantic-kernel-automation Bot added the python Pull requests for the Python Semantic Kernel label Oct 29, 2026

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.

🟡 Changes recommended

The combined name/alias lookup allows an earlier storage alias to shadow a declared property, making resolution order-dependent and potentially emitting the wrong storage name.

1 open issue
What changed in this PR

This PR addresses #14684 by aligning Azure AI Search hybrid requests with storage-name aliases used by index creation and vector-only search.

Changes:

  • Use storage names for hybrid text-search fields and vector queries.
  • Resolve custom additional_property_name values against configured fields.
  • Add regression coverage for default fields, declared property names, and direct storage-name inputs.
File Description
python/​tests/​unit/​connectors/​memory/​test_azure_ai_search.py Adds hybrid-search tests for aliased text and vector fields.
python/​semantic_kernel/​connectors/​azure_ai_search.py Applies storage-name resolution to hybrid search requests.

Review effort: Balanced

Comment on lines +603 to +604
if field.name == options.additional_property_name
or field.storage_name == options.additional_property_name

This branch was successfully deployed

1 active deployment
github-app-auth — 0450487f Deployed Oct 29, 2026 by Fire162 via add_label #29496
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: Bug: AzureAISearchCollection.hybrid_search sends declared field names instead of storage_name aliases

2 participants