perf(search): denormalize public compound catalog onto molecules - #1531
Open
vcnainala wants to merge 1 commit into
Open
perf(search): denormalize public compound catalog onto molecules#1531vcnainala wants to merge 1 commit into
vcnainala wants to merge 1 commit into
Conversation
Avoid nested studies/datasets/nmrium EXISTS on every compounds browse request by indexing membership and card badges onto molecules.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
molecules(has_public_spectra, sample counts, experiment types) so/search?scope=compoundsno longer runs nestedEXISTSqueries over studies/datasets/nmrium_infoon every request.nmrxiv:index-public-molecule-catalog(Laravel 13 signature attributes, constructor-freehandle()injection) scheduled daily; publish/unpublish/archive refresh the affected project or study immediately.WHERE has_public_spectra = true ORDER BY created_at DESC.Deploy
After merge, production compounds will be empty until the index runs:
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.phpnmrxiv:index-public-molecule-catalogon a copy of prod dataPOST /api/v1/search/compounds?limit=24&page=1&sort=recentwith empty query (expect well under 1s after index)