Skip to content

Add facetSearch and prefixSearch index settings#507

Open
claudeaceae wants to merge 1 commit intomeilisearch:mainfrom
claudeaceae:feat/facet-search-prefix-search-settings
Open

Add facetSearch and prefixSearch index settings#507
claudeaceae wants to merge 1 commit intomeilisearch:mainfrom
claudeaceae:feat/facet-search-prefix-search-settings

Conversation

@claudeaceae
Copy link
Copy Markdown

@claudeaceae claudeaceae commented Feb 12, 2026

Summary

Closes #456

Adds support for the facetSearch and prefixSearch index settings introduced in Meilisearch v1.12.0:

  • facetSearch (Bool): Controls whether facet search is enabled (default: true)
  • prefixSearch (String): Controls prefix matching behavior — "indexingTime" or "disabled" (default: "indexingTime")

Both settings support the standard get/update/reset pattern via dedicated API endpoints.

Changes

  • Setting.swift / SettingResult.swift: Added facetSearch and prefixSearch fields
  • Settings.swift: Added getFacetSearch, updateFacetSearch, resetFacetSearch, getPrefixSearch, updatePrefixSearch, resetPrefixSearch methods
  • Indexes.swift: Added public get/update/reset methods for both settings
  • Indexes+async.swift: Added async/await wrappers
  • Unit tests: 6 new tests (get/update/reset for each setting), all 95 tests pass
  • Integration tests: Added testFacetSearch() and testPrefixSearch() async test methods
  • Code samples: Added all 6 required samples (get_facet_search_settings_1, update_facet_search_settings_1, reset_facet_search_settings_1, get_prefix_search_settings_1, update_prefix_search_settings_1, reset_prefix_search_settings_1)

Usage

// Facet search
let isEnabled = try await index.getFacetSearch()
let task = try await index.updateFacetSearch(false)
let task = try await index.resetFacetSearch()

// Prefix search
let mode = try await index.getPrefixSearch()
let task = try await index.updatePrefixSearch("disabled")
let task = try await index.resetPrefixSearch()

Test plan

  • All 95 unit tests pass
  • Integration tests (require running Meilisearch v1.12+ instance)

Summary by CodeRabbit

  • New Features

    • Introduced facet search configuration management with get, update, and reset capabilities.
    • Introduced prefix search configuration management with get, update, and reset capabilities.
    • Expanded index and settings APIs to provide greater control over search behavior.
  • Tests

    • Added comprehensive test coverage for facet and prefix search configuration operations.

Implements meilisearch#456: adds get/update/reset methods for the `facetSearch`
(boolean) and `prefixSearch` (string) settings introduced in
Meilisearch v1.12.0. Includes async wrappers, unit tests (95 pass),
integration test stubs, and documentation code samples.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

This PR adds support for Meilisearch v1.12.0's new facetSearch and prefixSearch index settings. Six new methods are introduced for each setting (get, update, reset) across the Settings layer, Indexes layer, and async Indexes layer. Data models (Setting and SettingResult) are extended to include these fields, and comprehensive unit and integration tests are added.

Changes

Cohort / File(s) Summary
Model Extensions
Sources/MeiliSearch/Model/Setting.swift, Sources/MeiliSearch/Model/SettingResult.swift
Added facetSearch (Bool) and prefixSearch (String) properties to model structures, with corresponding initializer parameters in Setting.
Settings API
Sources/MeiliSearch/Settings.swift
Implemented six new methods: getFacetSearch(), updateFacetSearch(), resetFacetSearch(), getPrefixSearch(), updatePrefixSearch(), resetPrefixSearch() for index settings management.
Indexes API
Sources/MeiliSearch/Indexes.swift
Added six callback-based public methods mirroring Settings API, delegating to internal settings instance for facet and prefix search configuration.
Async Indexes API
Sources/MeiliSearch/Async/Indexes+async.swift
Added async wrapper methods for the six new settings operations, using withCheckedThrowingContinuation pattern consistent with existing async methods.
Code Samples
.code-samples.meilisearch.yaml
Added documentation examples for get, update, and reset operations on both facet search and prefix search settings.
Test Coverage
Tests/MeiliSearchIntegrationTests/SettingsTests.swift, Tests/MeiliSearchUnitTests/SettingsTests.swift
Added unit and integration tests for all six new operations on both settings types, including GET/PUT/DELETE lifecycle validation and default value assertions.

Poem

🐰 With whiskers twitched and code so keen,
Facets search and prefixes clean!
Six methods hop across the stack,
Settings query, update, rollback!
Meilisearch v1.12, here we go—
Watch these new configurations flow! ✨

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 64.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding facetSearch and prefixSearch index settings across multiple files.
Linked Issues check ✅ Passed All coding requirements from issue #456 are met: new methods added for get/update/reset facetSearch and prefixSearch at both index and settings levels, model fields added, unit and integration tests included, and all six code samples provided.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing facetSearch and prefixSearch settings as specified in issue #456; no unrelated or out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
Sources/MeiliSearch/Model/SettingResult.swift (1)

51-56: Consider using an enum for prefixSearch instead of a raw String.

The Meilisearch API only accepts "indexingTime" or "disabled" for prefixSearch. A raw String allows invalid values to be passed to updatePrefixSearch. An enum (similar to ProximityPrecision) would provide compile-time safety and discoverability:

public enum PrefixSearch: String, Codable, Equatable {
  case indexingTime
  case disabled
}

This would apply across Setting.prefixSearch, SettingResult.prefixSearch, and the get/update method signatures. This is a broader design change, so it could be deferred if you prefer to keep this PR minimal.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

[v1.12.0] New index settings: facetSearch and prefixSearch

2 participants