Skip to content

fix: support scoring profiles in Azure Search index parsing - #2383

Merged
Mark Hamilton (mhamilton723) merged 4 commits into
microsoft:masterfrom
DennizSvens:fix-scoring-profiles-azure-search
Jun 2, 2025
Merged

fix: support scoring profiles in Azure Search index parsing#2383
Mark Hamilton (mhamilton723) merged 4 commits into
microsoft:masterfrom
DennizSvens:fix-scoring-profiles-azure-search

Conversation

@DennizSvens

Copy link
Copy Markdown
Contributor

Related Issues/PRs

Fixes #2382

What changes are proposed in this pull request?

Fixes DeserializationException when writing data to Azure Search indices that contain scoring profiles. The JSON parser was expecting scoring profiles to be simple strings but Azure Search returns complex JSON objects.

Changes:

  • Add proper case classes for scoring profiles (ScoringProfile, ScoringFunction, etc.) in AzureSearchSchemas.scala
  • Update IndexInfo.scoringProfiles type from Option[Seq[String]] to Option[Seq[ScoringProfile]]
  • Add JSON formatters for all scoring profile-related case classes in AzureSearchProtocol
  • Support all scoring function types: freshness, magnitude, distance, and tag functions
  • Add comprehensive test to verify scoring profile parsing works correctly

This allows users to write data to Azure Search indices that have scoring profiles configured, which is common in production scenarios for relevance tuning.

How is this patch tested?

  • I have written tests (not required for typo or doc fix) and confirmed the proposed feature/bug-fix/change works.

Tests added:

  • test("Handle Azure Search index with scoring profiles") - Verifies parsing of index JSON containing scoring profiles
  • Test covers complex scoring profile with freshness function, boost values, and aggregation
  • Test validates all scoring profile fields are parsed correctly (name, functionAggregation, functions, etc.)
  • Test ensures no DeserializationException is thrown when parsing scoring profiles

Does this PR change any dependencies?

  • No. You can skip this section.

Does this PR add a new feature? If so, have you added samples on website?

  • No. You can skip this section.

@mhamilton723

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented May 29, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.61%. Comparing base (326988d) to head (eba1ad2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2383      +/-   ##
==========================================
- Coverage   84.63%   84.61%   -0.03%     
==========================================
  Files         331      331              
  Lines       17194    17201       +7     
  Branches     1513     1518       +5     
==========================================
+ Hits        14553    14555       +2     
- Misses       2641     2646       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mhamilton723

Copy link
Copy Markdown
Contributor

Thanks for your contribution, only style has failed

[error] /home/vsts/work/1/s/cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/search/SearchWriterSuite.scala:743:0: Whitespace at end of line
[error] /home/vsts/work/1/s/cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/search/SearchWriterSuite.scala:746:0: Whitespace at end of line
[error] /home/vsts/work/1/s/cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/search/SearchWriterSuite.scala:755:0: Whitespace at end of line

Please run stylechecker locally with sbt scalastyle test:scalastyle to get a local repro

@mhamilton723

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mhamilton723
Mark Hamilton (mhamilton723) merged commit 9af855e into microsoft:master Jun 2, 2025
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.

[BUG] Azure Search: DeserializationException when index contains scoring profiles

3 participants