Conversation
Drops the `if page?` guard so /users unconditionally returns a Page object. Adds a deterministic default sort (username asc) so paged responses are stable for clients walking nextPage links. Addresses production timeouts on /users?include=all. Pairs with ncbo/ontologies_linked_data#286 (idempotent User#admin?, drop inverse attrs from auth load) and the corresponding ontologies_api_ruby_client auto-paginate change. Tests updated for the paged response shape and cover ?pagesize and ?include=all combinations.
Commit 388d1bd ("converted acronyms filter from Boolean to Term syntax") replaced get_quoted_field_query_param at the start of filter_query construction in BOTH search_helper.rb (line 160) and properties_search_helper.rb (line 48). The new term-syntax function correctly early-returns "" for an empty acronyms list (an empty terms-query would itself be malformed), but the rest of filter_query construction in both helpers implicitly relied on the prior function's vacuous `submissionAcronym:""` placeholder always producing a non-empty starting clause. When acronyms filtered to empty (e.g. ontology_types restriction matches nothing, or the requesting user has no access to any of the requested ontologies), filter_query was "" and the subsequent `<< " AND <clause>"` appends produced a stray-AND fq that Solr rejected with 400 (surfaced as 500 by the API), breaking both /search and /property_search for any call whose acronyms resolved empty. Fix: when filter_query is empty after the acronyms step, use Solr's match-all literal `*:*`. AND'ing further clauses onto `*:*` narrows correctly, producing well-formed queries semantically equivalent to the constraints that follow. Also more correct than the pre-388d1bd behavior, which always silently added `submissionAcronym:""` (matching zero docs) when acronyms was empty — search-without-acronyms now actually returns matches. The third in-tree call site (search_helper.rb:181 — valueset_root_ids) is unaffected: it's already guarded by `unless valueset_root_ids.empty?` on the line above, so the function input is guaranteed non-empty. Adds regression tests for both endpoints exercising the empty-acronyms path via ontology_types=NONEXISTENT.
Fix: always paginate GET /users; /search 500 on empty acronym filter
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.
includes: