| Summary: | Support anti-the at REST API level | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Jonathan Druart <jonathan.druart> |
| Component: | REST API | Assignee: | Bugs List <koha-bugs> |
| Status: | In Discussion --- | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | lucas, martin.renvoize, tomascohen |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35560 | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
| Attachments: |
Bug 36633: Add anti-the support
Bug 36633: Add article-ignoring sort support to REST API |
||
|
Description
Jonathan Druart
2024-04-18 06:44:08 UTC
Martin, Tomas, did you think about that already? Not thought about this at all yet, but it's a really sensible question. I'll at as RT to ponder it. Created attachment 165306 [details] [review] Bug 36633: Add anti-the support Patch for discussion (to apply on top of bug 35560) It is suggesting to add a "modifier" to the order by attribute: +biblio.title/anti-the the remove a, an, the. Would that work? It's not really nice but I do not find something better for now. TODO: * tests * escape $param (see FIXME) * translatability of the stopwords Martin, Tomas, ping? I like the idea. 'anti-the' feels very 'koha' specific though.. I think what we're talking about here is known as 'natural sorting without articles' and the 'articles' are often defined as a stopwords list. I wonder if we could improve this with definable 'stopwords' lists for different languages and use the term 'ignore-stopwords' or similar in the sort attribute.. even now it's not just 'the' being filtered. Created attachment 190567 [details] [review] Bug 36633: Add article-ignoring sort support to REST API This patch adds support for ignoring leading articles (a, an, the, etc.) when sorting via the Koha REST API using an /ignore-articles suffix modifier on _order_by parameters. We add a new system preference 'ArticleSortStopwords' (default: "a|an|the") expecting a pipe-delimited list of articles to ignore when sorting. Usage examples: GET /api/v1/biblios?_order_by=+biblio.title/ignore-articles GET /api/v1/biblios?_order_by=-biblio.title/ignore-articles Test plan: 1. Apply patch and run database update 2. Run: prove t/db_dependent/Koha/REST/Plugin/Objects.t 3. Verify all tests pass 4. Test via REST API with /ignore-articles modifier 5. Configure ArticleSortStopwords system preference 6. Verify sorting ignores configured articles correctly My proposed alternative I like the idea of a configurable list. I have been wondering about this bit: + 'Pipe-delimited list of articles to ignore when sorting (e.g., a|an|the). Used by REST API /ignore-articles sort modifier and can be used by other sorting features. Articles are matched case-insensitively at the start of strings when followed by a space.', Maybe it would be safer to ask people to add the space in the list, as I think it won't work with the space for some languages like Arabic and Hebrew (IIRC). Maybe even French? (L'hotel ?) |