Voeg Activiteit en filtering toe aan RSS#114
Conversation
|
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/ |
berthubert
left a comment
There was a problem hiding this comment.
Please check these things - it appears that merging this would break things on https://berthub.eu/tkconv/
partials/search.html
Outdated
|
|
||
| {% 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" /> |
There was a problem hiding this comment.
De relative link of ?soorten? In het eerste geval drop ik gewoon de eerste commit.
There was a problem hiding this comment.
Oh right, op de echte site is het /tkconv. Ik drop de eerste commit voorlopig.
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
it looks like setting soorten to 'documenten' does nothing later on? does not do anything to 'categories'?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Sure this does what you want it to do on https://berthub.eu/tkconv/search.html ? I suspect not.
There was a problem hiding this comment.
I dropped the first commit, so this change is gone.
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).
|
I dropped 3758239 since the production site uses I'll look into #114 (comment) |
|
Marking as draft pending #116. |
|
This project is no longer considering LLM-generated code. |
De twee belangrijkste wijzigingen zijn:
soortenfiltering als op de search paginaDe RSS link op de zoekpagina zet (na deze PR) standaard
&soorten=alles. Voor backwards compatilibity met de bestaande RSS feeds, wordt de afwezigheid vansoortengeinterpreteerd alssoorten=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)struct RSSItemen tests die aantonen dat de RSS entries niet per ongeluk veranderen in latere commmits (pure refactor)