Search: public and semantic search accept the same field filters as the list
- Dominant language
- C#
- Stars
- 6
- Forks
- 7
- Avg merge
- 4h 21m
- Merged PRs (30d)
- 307
Description
`GET /api/public/{type}/search` reads `q` and `limit` and nothing else (`barakoCMS/Features/Public/Endpoints.cs:468-469`). `GET /api/public/{type}/semantic` is the same (`BarakoCMS.AI/Features/SemanticSearchEndpoint.cs:48-49`). The list route's filters come from `DeliveryQuery.Parse`, and the list is its only caller (`Endpoints.cs:336`).
### Why it is too specific
Search assumes one flat pool per type. A clinic searching services at one branch, a school searching news in one category, or an events site searching only upcoming events has to search everything and filter in the renderer. That breaks the limit: the top 20 matches may hold none in the category asked for.
### The general concept
Both search routes accept the list's `filter[field][op]` parameters through `DeliveryQuery.Parse`, with the same public field allow-list and rules, applied in the query before ranking and the limit.
### Where it lives
Core public delivery, and the AI module's semantic search endpoint.
### Compatibility
Released. Optional query parameters, additive. A search with no filter answers as today.
### Done when
- Search with `filter[Category][eq]=news` returns only matches in that category even when more than `limit` matches sit outside it, with a test that fails before the change.
- A filter on a field that is not Public is refused the way the list refuses it.
- Semantic search applies the same filter before ranking.
Relates #825.
Found in the architecture sweep of 15 September 2026.
Contributor guide
Research direction
Start with barakoCMS/Features/Public/Endpoints.cs:468-469 and BarakoCMS.AI/Features/SemanticSearchEndpoint.cs:48-49, then read DeliveryQuery.Parse and its list caller at Endpoints.cs:336 to understand the existing public-field rules. Add coverage for category filtering, rejection of non-Public fields, and semantic filtering before ranking; done means filtered results respect the limit while unfiltered searches remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100