From 2837d5e0496f68cabdfaf3e341b220bdcc972247 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 1 Sep 2026 16:45:30 +0200 Subject: [PATCH 1/3] Restrict default Discovery search to items only 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 --- dspace/config/spring/api/discovery.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dspace/config/spring/api/discovery.xml b/dspace/config/spring/api/discovery.xml index 3509056e9792..81ec83e7bcda 100644 --- a/dspace/config/spring/api/discovery.xml +++ b/dspace/config/spring/api/discovery.xml @@ -259,8 +259,8 @@ queries done by discovery for this configuration --> - - (search.resourcetype:Item AND latestVersion:true) OR search.resourcetype:Collection OR search.resourcetype:Community + + search.resourcetype:Item AND latestVersion:true -withdrawn:true AND -discoverable:false From c748bd077172b5c6cadcd99761779d3ab735e087 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 1 Sep 2026 16:56:03 +0200 Subject: [PATCH 2/3] Make default-search resource types configurable via discovery.cfg 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 --- dspace/config/modules/discovery.cfg | 5 +++++ dspace/config/spring/api/discovery.xml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dspace/config/modules/discovery.cfg b/dspace/config/modules/discovery.cfg index 1b736d9ac868..7d1e095c3380 100644 --- a/dspace/config/modules/discovery.cfg +++ b/dspace/config/modules/discovery.cfg @@ -7,6 +7,11 @@ ##### Search Indexing ##### discovery.search.server = ${solr.server}/${solr.multicorePrefix}search +# Resource types returned by the default search (/search). Items only by default (CLARIN). +# To also return communities and collections, use: +# discovery.search.default.filterquery = (search.resourcetype:Item AND latestVersion:true) OR search.resourcetype:Collection OR search.resourcetype:Community +discovery.search.default.filterquery = search.resourcetype:Item AND latestVersion:true + #Enable the url validation of the search.server setting above. #Defaults to true: validation is enabled #discovery.solr.url.validation.enabled = true diff --git a/dspace/config/spring/api/discovery.xml b/dspace/config/spring/api/discovery.xml index 81ec83e7bcda..0b176ede1b30 100644 --- a/dspace/config/spring/api/discovery.xml +++ b/dspace/config/spring/api/discovery.xml @@ -259,8 +259,8 @@ queries done by discovery for this configuration --> - - search.resourcetype:Item AND latestVersion:true + + ${discovery.search.default.filterquery} -withdrawn:true AND -discoverable:false From 899be67b912518d00e625d94ba84349a8cd50715 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Wed, 2 Sep 2026 10:20:12 +0200 Subject: [PATCH 3/3] Keep all-types default search in test config for upstream Discovery ITs 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 --- dspace-api/src/test/data/dspaceFolder/config/local.cfg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dspace-api/src/test/data/dspaceFolder/config/local.cfg b/dspace-api/src/test/data/dspaceFolder/config/local.cfg index 56528a02a4a5..ae9b2b8b16fb 100644 --- a/dspace-api/src/test/data/dspaceFolder/config/local.cfg +++ b/dspace-api/src/test/data/dspaceFolder/config/local.cfg @@ -105,6 +105,10 @@ event.dispatcher.default.consumers = versioning, discovery, eperson, orcidqueue, event.dispatcher.exclude-discovery.class = org.dspace.event.BasicDispatcher event.dispatcher.exclude-discovery.consumers = versioning, eperson, qaeventsdelete, ldnmessage +# The CLARIN default search is items-only (see config/modules/discovery.cfg); the upstream Discovery +# ITs assert communities and collections in the default search, so keep the original all-types query here. +discovery.search.default.filterquery = (search.resourcetype:Item AND latestVersion:true) OR search.resourcetype:Collection OR search.resourcetype:Community + # Configure authority control for Unit Testing (in DSpaceControlledVocabularyTest) # (This overrides default, commented out settings in dspace.cfg) plugin.selfnamed.org.dspace.content.authority.ChoiceAuthority = \