Skip to content

perf(search): denormalize public compound catalog onto molecules - #1531

Open
vcnainala wants to merge 1 commit into
developmentfrom
perf/index-public-molecule-catalog
Open

perf(search): denormalize public compound catalog onto molecules#1531
vcnainala wants to merge 1 commit into
developmentfrom
perf/index-public-molecule-catalog

Conversation

@vcnainala

Copy link
Copy Markdown
Member

Summary

  • Persist public-catalog membership and compound-card badges on molecules (has_public_spectra, sample counts, experiment types) so /search?scope=compounds no longer runs nested EXISTS queries over studies/datasets/nmrium_info on every request.
  • Add nmrxiv:index-public-molecule-catalog (Laravel 13 signature attributes, constructor-free handle() injection) scheduled daily; publish/unpublish/archive refresh the affected project or study immediately.
  • Browse/search now filters WHERE has_public_spectra = true ORDER BY created_at DESC.

Deploy

After merge, production compounds will be empty until the index runs:

php artisan migrate --no-interaction
php artisan nmrxiv:index-public-molecule-catalog

The first run can take several minutes (same JSON work as before, once). Restart Octane after migrate.

Test plan

  • php artisan test --compact tests/Unit/Support/Public/PublicMoleculeCatalogIndexerTest.php tests/Feature/Commands/IndexPublicMoleculeCatalogCommandTest.php tests/Unit/Support/Public/PublicMoleculeAggregatesTest.php tests/API/SearchControllerTest.php tests/Feature/StatsPageTest.php
  • Run migrate + nmrxiv:index-public-molecule-catalog on a copy of prod data
  • Time POST /api/v1/search/compounds?limit=24&page=1&sort=recent with empty query (expect well under 1s after index)
  • Publish a project and confirm its compounds appear without waiting for the daily command
  • Confirm unpublished/archived compounds drop out of the catalog after the action (or the next index)

Avoid nested studies/datasets/nmrium EXISTS on every compounds browse
request by indexing membership and card badges onto molecules.
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