Add query-aware search policies#27
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a query-aware “policy” layer to mdorigin’s search configuration so retrieval behavior can vary for short vs long queries, while keeping the public /api/search surface limited to q, topK, and meta.* filters.
Changes:
- Introduce
search.policy.shortQuery/search.policy.longQueryconfig (withnullto explicitly clear inherited defaults) and normalize it in site config loading. - Resolve effective search options per request based on trimmed query length (Unicode code points), with
shortQuerytaking precedence when thresholds overlap. - Add tests and documentation covering dynamic policy behavior and precedence rules.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/search.ts | Adds policy-aware option resolution and applies it across SearchApi implementations. |
| src/search.test.ts | Adds integration tests validating long/short policy selection and null clearing behavior. |
| src/core/site-config.ts | Extends and normalizes site search config to support query-aware policy entries. |
| src/core/site-config.test.ts | Verifies policy normalization (including null overrides) during config loading. |
| skills/mdorigin/SKILL.md | Notes that sites can configure query-aware search policies. |
| docs/site/reference/configuration.md | Documents policy keys, matching rules, and null clearing semantics with an example. |
| docs/site/guides/getting-started.md | Adds getting-started guidance and example config for dynamic search policy. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+25
to
+28
| SiteSearchLongQueryPolicyConfig, | ||
| SiteSearchPolicyOverrideConfig, | ||
| SiteSearchRerankerConfig, | ||
| SiteSearchShortQueryPolicyConfig, |
There was a problem hiding this comment.
SiteSearchLongQueryPolicyConfig and SiteSearchShortQueryPolicyConfig are imported but never used in this file. Removing unused type imports will keep the module clean and avoids future lint/CI failures if unused-import checks are added.
Suggested change
| SiteSearchLongQueryPolicyConfig, | |
| SiteSearchPolicyOverrideConfig, | |
| SiteSearchRerankerConfig, | |
| SiteSearchShortQueryPolicyConfig, | |
| SiteSearchPolicyOverrideConfig, | |
| SiteSearchRerankerConfig, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
search.policy.shortQueryandsearch.policy.longQueryon top of site-level search defaults/api/searchlimited toq,topK, andmeta.*nulloverrides that explicitly clear inherited defaultsTesting
Closes #26