Skip to content

Commit f378755

Browse files
KasinhouMatus Kasakclaude
authored
Clarin9/Make default search items-only, configurable via discovery.cfg (#1423)
* 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 <noreply@anthropic.com> * 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 <noreply@anthropic.com> * 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 <noreply@anthropic.com> --------- Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b13cdd7 commit f378755

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

dspace-api/src/test/data/dspaceFolder/config/local.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ event.dispatcher.default.consumers = versioning, discovery, eperson, orcidqueue,
105105
event.dispatcher.exclude-discovery.class = org.dspace.event.BasicDispatcher
106106
event.dispatcher.exclude-discovery.consumers = versioning, eperson, qaeventsdelete, ldnmessage
107107

108+
# The CLARIN default search is items-only (see config/modules/discovery.cfg); the upstream Discovery
109+
# ITs assert communities and collections in the default search, so keep the original all-types query here.
110+
discovery.search.default.filterquery = (search.resourcetype:Item AND latestVersion:true) OR search.resourcetype:Collection OR search.resourcetype:Community
111+
108112
# Configure authority control for Unit Testing (in DSpaceControlledVocabularyTest)
109113
# (This overrides default, commented out settings in dspace.cfg)
110114
plugin.selfnamed.org.dspace.content.authority.ChoiceAuthority = \

dspace/config/modules/discovery.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
##### Search Indexing #####
88
discovery.search.server = ${solr.server}/${solr.multicorePrefix}search
99

10+
# Resource types returned by the default search (/search). Items only by default (CLARIN).
11+
# To also return communities and collections, use:
12+
# discovery.search.default.filterquery = (search.resourcetype:Item AND latestVersion:true) OR search.resourcetype:Collection OR search.resourcetype:Community
13+
discovery.search.default.filterquery = search.resourcetype:Item AND latestVersion:true
14+
1015
#Enable the url validation of the search.server setting above.
1116
#Defaults to true: validation is enabled
1217
#discovery.solr.url.validation.enabled = true

dspace/config/spring/api/discovery.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@
259259
queries done by discovery for this configuration -->
260260
<property name="defaultFilterQueries">
261261
<list>
262-
<!--Only find items, communities and collections-->
263-
<value>(search.resourcetype:Item AND latestVersion:true) OR search.resourcetype:Collection OR search.resourcetype:Community</value>
262+
<!--CLARIN: resource types returned by the default search; configurable via discovery.cfg (items only by default)-->
263+
<value>${discovery.search.default.filterquery}</value>
264264
<value>-withdrawn:true AND -discoverable:false</value>
265265
</list>
266266
</property>

0 commit comments

Comments
 (0)