Skip to content

Voeg Activiteit en filtering toe aan RSS#114

Closed
Sjors wants to merge 4 commits intoberthubert:mainfrom
Sjors:2026/03/rss
Closed

Voeg Activiteit en filtering toe aan RSS#114
Sjors wants to merge 4 commits intoberthubert:mainfrom
Sjors:2026/03/rss

Conversation

@Sjors
Copy link
Copy Markdown

@Sjors Sjors commented Mar 14, 2026

De twee belangrijkste wijzigingen zijn:

  1. Voeg activiteiten (zoals commissiedebatten) toe aan de RSS feed
  2. Ondersteun dezelfde soorten filtering als op de search pagina

De RSS link op de zoekpagina zet (na deze PR) standaard &soorten=alles. Voor backwards compatilibity met de bestaande RSS feeds, wordt de afwezigheid van soorten geinterpreteerd als soorten=documenten, dus er komen geen nieuwe items tevoorschijn.

Fixes #113.

Met de nodige LLM hulp geschreven, maar wel lokaal getest.

Als je de commits op volgorde reviewt zou het goed te volgen moeten zijn:

  • Use root-relative RSS URL: zodat de RSS feed link naar localhost gaat als de site lokaal draait (voor developers)
  • Add makeRSSItem helper and test: introduceert struct RSSItem en tests die aantonen dat de RSS entries niet per ongeluk veranderen in latere commmits (pure refactor)
  • Use search result fields directly in RSS handler: maakt de XML query korter (pure refactor)
  • Extract searchResultMatchesSoorten helper: om code duplicatie te voorkomen in de volgende commit (pure refactor)
  • Make search RSS honor soorten filters: de daadwerkelijke wijziging

@Sjors
Copy link
Copy Markdown
Author

Sjors commented Mar 14, 2026

P.S. ik heb ook nog een branch met dingen die het makkelijker maken om niet de gehele datadump te downloaden. Kijk maar of er iets nuttigs tussen zit: https://github.com/Sjors/tkconv/commits/2026/03/dev/

Copy link
Copy Markdown
Owner

@berthubert berthubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check these things - it appears that merging this would break things on https://berthub.eu/tkconv/


{% block extrameta %}
<link rel="alternate" type="application/rss+xml" href="https://berthub.eu/tkconv/search/index.xml?q={{q}}" title="OpenTK zoek RSS" />
<link rel="alternate" type="application/rss+xml" href="/search/index.xml?q={{q}}&soorten={{soorten}}" title="OpenTK zoek RSS" />
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dit breekt de site

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

De relative link of ?soorten? In het eerste geval drop ik gewoon de eerste commit.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, op de echte site is het /tkconv. Ik drop de eerste commit voorlopig.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took another stab at this in #116 because it's a bit tedious to test this PR otherwise.

// and historically only returned Documents. Treat absent soorten the
// same as the explicit "documenten" filter so new Activiteit items
// don't suddenly appear in existing subscribers' feeds.
if(soorten.empty())
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like setting soorten to 'documenten' does nothing later on? does not do anything to 'categories'?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an example of a search query where the difference would be obvious?

html/logic.js Outdated
const data = await response.json();
f.foundDocs = data["results"];
const rssurl = new URL("https://berthub.eu/tkconv/search/index.xml");
const rssurl = new URL("/search/index.xml", window.location.origin);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure this does what you want it to do on https://berthub.eu/tkconv/search.html ? I suspect not.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dropped the first commit, so this change is gone.

Sjors added 4 commits March 14, 2026 20:40
Extract the title/description/link/guid logic for RSS items into
a standalone function so it can be tested without pugixml.

Add tests for Document 2026D10396, Motie 2026D05246 and Schriftelijke
vragen 2026D10272 to lock down current behaviour.
The RSS handler previously re-queried every Document field (onderwerp,
titel, bijgewerkt) from the database even though SearchHelper::search()
already populates these on each Result.  Simplify the SQL to only fetch
the committee name (ZaakActor) and read the remaining fields from the
Result struct.

Also drop the 'if (docs.empty()) skip' guard: SearchHelper::search()
already skips any document not found in the Document table (search.cc
line 65-66), so results that reach this loop are guaranteed to exist.
Move the soorten filter logic out of the search POST handler in
tkserv.cc into a testable free function in search.cc. This is
needed in a later commit to filter the RSS feed by soorten.
Extend makeRSSItem to handle non-Document results (Activiteit,
Verslag, Toezegging, PersoonGeschenk) with appropriate
link/guid/description formats.

For backward compatibility, treat the absence of a soorten parameter
in RSS URLs as "documenten" so existing subscribers only see
Documents.  The search.html page defaults soorten to "alles" in
its RSS <link> tag, so new subscriptions explicitly opt-in to all
result types.

Pass the soorten parameter through to the search.html template so
the filter carries over to the RSS URL.

Add test case for Activiteit 2026A01281 (requires the new non-Document
code path in makeRSSItem).
@Sjors
Copy link
Copy Markdown
Author

Sjors commented Mar 14, 2026

I dropped 3758239 since the production site uses /tkconf while my local testing setup uses / and it's not important enough to work around.

I'll look into #114 (comment) next week soon.

@Sjors Sjors marked this pull request as draft March 23, 2026 10:03
@Sjors
Copy link
Copy Markdown
Author

Sjors commented Mar 23, 2026

Marking as draft pending #116.

@berthubert
Copy link
Copy Markdown
Owner

This project is no longer considering LLM-generated code.

@berthubert berthubert closed this Mar 27, 2026
@Sjors Sjors deleted the 2026/03/rss branch March 29, 2026 12:13
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.

rss feed negeert soorten parameter

2 participants