Clarin9/Make default search items-only, configurable via discovery.cfg - #1423
Conversation
Remove communities and collections from the default search configuration's filter queries so /search returns items only (restores CLARIN v7 behaviour at the source, for all API consumers). Query-time filter; no reindex needed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Restricts the default Discovery (Solr-backed) /search behavior to return items only, restoring CLARIN v7 behavior at the backend configuration layer so it applies consistently to all API consumers.
Changes:
- Updated the default Discovery
defaultFilterQueriesto removeCollectionandCommunityresource types from the default search filter. - Updated the inline XML comment to reflect the CLARIN-specific intent of the default filter.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Externalize the default Discovery filter query to a new discovery.search.default.filterquery property (items only by default; documented all-types alternative), referenced from discovery.xml. Admins can now include/exclude communities and collections from /search without editing Spring XML. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The upstream DiscoveryRestControllerIT / DiscoveryVersioningIT assert that the default search returns communities and collections. The CLARIN default is now items-only, so pin the original all-types filter query in the test local.cfg to keep those ITs valid without editing their assertions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CI fix — Discovery IT failuresThe 10 failing integration tests ( Fix (last commit): pin the original all-types filter query in the integration-test config ( Net result: CLARIN default = items-only (
|
What
Restrict the default Discovery search to items only (so
/searchno longer returns communities and collections — restoring CLARIN v7 behaviour), and make it configurable so admins can toggle it without touching Spring XML.Changes
dspace/config/spring/api/discovery.xml—defaultConfiguration→defaultFilterQueries: replace the hardcoded type list with a property reference:dspace/config/modules/discovery.cfg— new property (items only by default, all-types alternative documented inline):To include communities/collections again, override the property in
local.cfgand restart — no XML edit, no reindex.Why backend (and configurable) instead of frontend
clarin-search.component); the v9 upgrade dropped that component, causing the regression. Fixing it server-side and exposing a config key avoids per-client workarounds and lets each deployment decide.Notes / scope
discovery.xml/ config).communityConfigurationandcollectionConfigurationinherit fromdefaultConfiguration, so scoped search within a community/collection is also items-only (desired for CLARIN).Verification (dockerized demo backend, default
/search)...:Item ...(items only, default)... OR Collection OR Community(all types)Toggling the single
discovery.search.default.filterqueryproperty and restarting flips the behaviour both ways — confirming the placeholder resolves fromdiscovery.cfgand the feature is configurable end-to-end.🤖 Generated with Claude Code