feat(azure-ai-search): Allow full metadata field customization #1676
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issues
(None)
Proposed Changes:
Currently, the
metadata_fields
init parameter only allowed a few custom simple value types to be mapped (e.g., no nested metadata) and also hardcoded the fields to be onlyfilterable
(but notsearchable
orfacetable
, for instance).For full flexibility, allow an Azure AI Search
SearchField
instance to be passed as mapping instead of a Python type. For example:How did you test it?
Updated and ran the unit + integration tests.
Notes for the reviewer
Internally, all metadata field mappinhs are now mapped to
SearchField
instances and are also serialized that way. This simplifies the code and also fixes the potential issues around trying to serializetype
objects by name.I noticed a type error that I fixed in this PR as well: the
filters
parameter of the_*_retrieval()
methods was clearly meant to bestr
(judging from the Retriever code calling it), but was accidentally typed asDict[str, Any]
.Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.