Clarin9/Restrict main search page to items only - #1487
Open
Kasinhou wants to merge 1 commit into
Open
Conversation
The main /search page previously returned all DSpace object types (items, collections and communities), matching the backend `default` discovery configuration. In v7 only items were shown there. Add a reusable `forcedDsoTypes` input to the (themed) SearchComponent that forces the given DSpaceObject types onto every search request the component makes, and set it to items only on the main search page. Community and collection results are therefore hidden from /search, while other search pages (MyDSpace, admin, browse, scoped configuration searches) are untouched. Clearing SearchPageComponent.forcedDsoTypes restores the previous behaviour, and the input can be reused to expose this as a facet/config later. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Kasinhou
force-pushed
the
clarin9/search-items-only
branch
from
August 26, 2026 13:44
484c30b to
d468754
Compare
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.
Problem
On the main /search page the result list shows all DSpace object types — items, collections and communities — because the backend
defaultdiscovery configuration indexes all of them. In v7 only items were shown on the search page.Verified against the live v9 dev backend (dev-6):
configuration=default→ 2373 resultsconfiguration=default&dsoType=item→ 2348 results (25 collections/communities filtered out)Fix (frontend only)
Add a reusable
forcedDsoTypesinput to the (themed)SearchComponent. When set, thoseDSpaceObjectTypes are forced onto every search request the component makes (they map todsoType=query params on the RESTdiscover/search/objectscall), regardless of the discovery configuration.The main search page sets it to items only, so community/collection results are hidden from
/search. Facets/filters are driven by the discovery configuration and are left untouched, as are all other search surfaces (MyDSpace, admin search, browse, scoped configuration searches).Why this shape
SearchPageComponent.forcedDsoTypesrestores the previous "all types" behaviour.dsoTypein the URL still wins (the force only applies when no dsoType is already present).Changes
shared/search/search.component.ts— new@Input() forcedDsoTypes; injected into the combined search options (so results and CSV export stay consistent).shared/search/themed-search.component.ts— thread the input through the themed wrapper.search-page/search-page.component.{ts,html}— setforcedDsoTypes = [ITEM]on the main search page (shared by base + custom theme).shared/search/search.component.spec.ts— test that the configured types are applied.Testing
tsc -p tsconfig.app.json --noEmitpasses.dsoTypefilter (counts above).🤖 Generated with Claude Code