Skip to content

fix(endpoint-micropub): honour filter on q=source, add category - #991

Merged
paulrobertlloyd merged 1 commit into
mainfrom
feat/endpoint-micropub-source-filters
Oct 10, 2026
Merged

paulrobertlloyd merged 1 commit into
mainfrom
feat/endpoint-micropub-source-filters

Conversation

@rmdes

@rmdes rmdes commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Fixes #990.

filter is a case-insensitive match on a post's name or content, category an exact category; both are cast to strings so nothing reaches the database as an operator, and both are passed to getCursor as its filter so paging keeps working within the match (the cursor's filter option landed with #944).

Four integration tests, seen failing first. README documents category.

This is one of the last six changes ported from my fork; nothing here needs to hold a release.

The README promises `filter` for every list query and gives
`/micropub?q=source&filter=web` as the example, but the source query
ignored it: the parameter only ever reached the configuration queries.
Honour it for posts as a case-insensitive match on the name and content,
and accept `category` alongside it for posts carrying that category.

Filtering keeps paging: getCursor takes an optional query that is merged
into the range condition and into the hasNext/hasPrev probes, so a filtered
page reports whether more filtered items exist rather than whether more
items exist at all. Existing callers are unaffected; the parameter defaults
to an empty object.

Tests cover the cursor filter in util, and for the endpoint: match by name,
match by content, match by category, both together across two pages, and
no match.
@paulrobertlloyd
paulrobertlloyd merged commit b792c1a into main Oct 10, 2026
2 checks passed
@paulrobertlloyd
paulrobertlloyd deleted the feat/endpoint-micropub-source-filters branch October 10, 2026 17:43
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.

q=source ignores the documented filter parameter

2 participants