Skip to content

Mobile API: real catalogue languages endpoint + tolerant language filter (#282)#285

Open
fabiodalez-dev wants to merge 2 commits into
mainfrom
feat/mobile-language-filter-282
Open

Mobile API: real catalogue languages endpoint + tolerant language filter (#282)#285
fabiodalez-dev wants to merge 2 commits into
mainfrom
feat/mobile-language-filter-282

Conversation

@fabiodalez-dev

Copy link
Copy Markdown
Owner

Backend part of #282 (HansUwe52's Android-app report). The app-side changes ship in the Pinakes-Android repo (linked separately).

Root cause

Uwe reports that combining a language with any other filter (category / author / publisher) returns no results. libri.lingua is unnormalized free text — a real catalogue holds italiano, inglese, English, Deutsch, Français side by side — but the app's language filter is a hardcoded predefined list. The app sends e.g. German while the row says Deutsch; the exact-match l.lingua = ? matches nothing, so any filter combined with language collapses to zero. (Category/author/publisher work because the app sources those from the collection.)

Changes

  • GET /api/v1/catalog/languages — distinct language values actually present in the non-deleted catalogue, each with a book count, ordered by frequency. The app populates its language filter from this (real data), exactly as it already does for genres/authors/publishers, so a selected language always matches. Read-only, ETag/304-cached like the sibling catalog reads; documented in OpenApi; one row added to the idempotency manifest.
  • Case/space-insensitive language filter in search: LOWER(TRIM(l.lingua)) = LOWER(TRIM(?)), so a value echoed back from the endpoint matches regardless of casing/whitespace.

The sort request

Uwe also asks to sort the home list by title/author. GET /api/v1/catalog/search already supports sort (title/author, keyset-safe) — so that part is purely an app-side UI addition, no backend change needed.

Verified

  • mobile-api-idempotency.spec.js 43/43, including the manifest-covers-every-exposed-route guard and 2× GET /catalog/languages (idempotent 200 + ETag/304).
  • PHPStan clean. Mobile API plugin 1.4.0 → 1.4.1.

… language filter

Uwe reports (#282) that combining a language with any other filter (category,
author, publisher) in the Android app returns no results. Root cause: libri.lingua
is unnormalized free text (a dev catalogue holds "italiano", "inglese", "English",
"Deutsch", "Français" side by side), but the app's language filter is a hardcoded
predefined list. So the app sends e.g. "German" while the row says "Deutsch", the
exact-match l.lingua = ? matches nothing, and any filter combined with language
collapses to zero.

- New GET /api/v1/catalog/languages returns the distinct language values actually
  present in the (non-deleted) catalogue, each with its book count, ordered by
  frequency. The app should populate its language filter from this — the real
  collection values — exactly as it already sources genres/authors/publishers,
  so a selected language always matches. Read-only, ETag-cached like the other
  catalog read endpoints; documented in OpenApi; one manifest row added to the
  idempotency guard.
- The search language filter is now case/space-insensitive
  (LOWER(TRIM(l.lingua)) = LOWER(TRIM(?))) so a value echoed back from the
  endpoint matches regardless of casing/whitespace.

Note: catalog search already supports sort (title/author), so the app's
"sort by title/author" request in #282 needs only an app-side UI change; the
language-filter fix needs the app to consume the new endpoint. Those app
changes ship in the Pinakes-Android repo.

Mobile API plugin 1.4.0 -> 1.4.1. Verified: mobile-api-idempotency.spec.js 43/43
(incl. the manifest-covers-every-route guard and 2x /catalog/languages ETag/304),
PHPStan clean.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@fabiodalez-dev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 29 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 93500bac-4170-47d6-acde-909a5c5203f3

📥 Commits

Reviewing files that changed from the base of the PR and between aae6353 and 3032cee.

📒 Files selected for processing (11)
  • locale/de_DE.json
  • locale/en_US.json
  • locale/fr_FR.json
  • locale/it_IT.json
  • storage/plugins/mobile-api/MobileApiPlugin.php
  • storage/plugins/mobile-api/plugin.json
  • storage/plugins/mobile-api/src/Controllers/CatalogController.php
  • storage/plugins/mobile-api/src/Controllers/OpenApiController.php
  • tests/code-quality.spec.js
  • tests/mobile-api-idempotency.spec.js
  • tests/mobile-language-filter-282.unit.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mobile-language-filter-282

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant