Problem
Score set search does unbounded work per request.
search_score_sets (routers/score_sets.py:699) caps results at SCORE_SET_SEARCH_MAX_LIMIT only when publication_identifiers is absent. A search with publication identifiers has no cap, and search_my_score_sets (:812) has none either.
- The search routes build the full score set view model for each result and then trim it to the short one, which triggers about 15 lazy-load queries per result.
get_filter_options_for_search (:753, through fetch_score_set_search_filter_options in lib/score_sets.py) loads every matching score set plus 8–15 queries each. The ui calls it after every pause in typing, and the handler keeps running after the ui cancels.
Scope
- Apply the cap to every search, including publication-identifier searches and
/me/score-sets/search.
- Build the short view model directly, with loader options for the fields it serializes.
- Compute filter options with aggregate queries over the matching set, not by loading score sets.
Acceptance criteria
Problem
Score set search does unbounded work per request.
search_score_sets(routers/score_sets.py:699) caps results atSCORE_SET_SEARCH_MAX_LIMITonly whenpublication_identifiersis absent. A search with publication identifiers has no cap, andsearch_my_score_sets(:812) has none either.get_filter_options_for_search(:753, throughfetch_score_set_search_filter_optionsinlib/score_sets.py) loads every matching score set plus 8–15 queries each. The ui calls it after every pause in typing, and the handler keeps running after the ui cancels.Scope
/me/score-sets/search.Acceptance criteria
SCORE_SET_SEARCH_MAX_LIMITresults.