Skip to content

feat: add --set option to app:meilisearch:index - #78

Merged
toxicity1985 merged 1 commit into
mainfrom
feature/meilisearch-index-by-set
Oct 6, 2026
Merged

toxicity1985 merged 1 commit into
mainfrom
feature/meilisearch-index-by-set

Conversation

@toxicity1985

Copy link
Copy Markdown
Collaborator

Contexte

Après app:fix:missing-card-set (89 cartes rattachées à EOLECB / EOLEOP / EOLETOP), il faut réindexer ces cartes dans Meilisearch pour que le filtre set_reference les remonte. L'index complet échoue en prod : la requête unique sur 5,4 M de cartes (GROUP BY sur ~20 jointures) remplit pgsql_tmp → SQLSTATE[53100]: Disk full.

Changements

  • app:meilisearch:index --set=EOLECB,EOLEOP,EOLETOP : ne streame et n'upserte que les cartes de ces sets
  • CardDocumentRepository::streamDocuments() accepte une liste de références de set (WHERE cs.reference IN (...))
  • Nouveau CardDocumentRepository::countBySetReferences() pour la barre de progression
  • --set refusé avec --clear (effacerait tous les autres sets) et avec --fields — vérifié avant toute action
  • Sortie propre si aucune carte ne correspond (la barre de progression plantait avec max = 0)

Tests

  • tests/Unit/Repository/CardDocumentRepositoryTest.php : SQL et paramètres du filtre par set, absence de filtre par défaut, count
  • tests/Unit/Command/MeilisearchIndexCommandTest.php : garde-fous --clear / --fields, parsing de --set, set inconnu

php bin/phpunit --testsuite Unit → OK (26 tests). Non testé contre une vraie base Postgres / Meilisearch.

Après déploiement

php bin/console app:meilisearch:index --set=EOLECB,EOLEOP,EOLETOP
php bin/console cache:pool:clear cache.card_counts

🤖 Generated with Claude Code

Allows re-indexing only the cards of given sets (e.g. after
app:fix:missing-card-set) instead of streaming all 5.4M cards in a
single GROUP BY query, which fills Postgres temp space on prod.

- CardDocumentRepository::streamDocuments() accepts set references
- new CardDocumentRepository::countBySetReferences()
- --set is rejected with --clear (would wipe other sets) and --fields
- exit cleanly when no cards match (progress bar crashed on max=0)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@toxicity1985
toxicity1985 merged commit 9684ae4 into main Oct 6, 2026
2 checks passed
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