Skip to content

Support PUT /indexes/{name} for create-or-update (closes #30)#31

Merged
IndifferentDisdain merged 2 commits intomainfrom
issue/30-support-put
Apr 24, 2026
Merged

Support PUT /indexes/{name} for create-or-update (closes #30)#31
IndifferentDisdain merged 2 commits intomainfrom
issue/30-support-put

Conversation

@IndifferentDisdain
Copy link
Copy Markdown
Contributor

Summary

  • Adds a PUT /indexes/{name} handler to IndexesController with Azure-style create-or-update semantics: creates the index when absent (returns 201 Created) and overwrites the schema when present (returns 200 OK). This unblocks SearchIndexClient.CreateOrUpdateIndexAsync(...) from the Azure SDK, which previously got 405 Method Not Allowed.
  • Validates the URL key matches index.Name (case-insensitive) and clears the cached Lucene reader/directory on update so schema changes take effect.
  • Adds Update to ISearchIndexRepository and a file-overwrite implementation in FileSearchIndexRepository.
  • Adds two integration tests exercising the SDK's CreateOrUpdateIndexAsync: one for PUT-creates-new-index and one for PUT-updates-existing-with-added-field.

Closes #30.

Test plan

  • dotnet build AzureSearchEmulator.sln — clean
  • dotnet test AzureSearchEmulator.UnitTests — 108/108 passing
  • dotnet test AzureSearchEmulator.IntegrationTests — 19/19 passing (17 existing + 2 new)

🤖 Generated with Claude Code

IndifferentDisdain and others added 2 commits April 24, 2026 12:00
Adds a PUT handler that creates the index when absent and overwrites
its schema when present, matching Azure AI Search's CreateOrUpdateIndex
behavior so the Azure SDK's CreateOrUpdateIndexAsync works against the
emulator. On update, cached Lucene reader/directory entries are cleared
so schema changes take effect. Closes #30.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@IndifferentDisdain IndifferentDisdain marked this pull request as ready for review April 24, 2026 16:04
@IndifferentDisdain IndifferentDisdain merged commit 4ec17f8 into main Apr 24, 2026
2 checks passed
@IndifferentDisdain IndifferentDisdain deleted the issue/30-support-put branch April 24, 2026 16:04
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.

PUT /indexes/{name} returns 405 — Azure SDK CreateOrUpdateIndex unusable against emulator

1 participant