Skip to content

Clarin9/Restrict main search page to items only - #1487

Open
Kasinhou wants to merge 1 commit into
dtq-dev-9-basefrom
clarin9/search-items-only
Open

Clarin9/Restrict main search page to items only#1487
Kasinhou wants to merge 1 commit into
dtq-dev-9-basefrom
clarin9/search-items-only

Conversation

@Kasinhou

Copy link
Copy Markdown

Problem

On the main /search page the result list shows all DSpace object types — items, collections and communities — because the backend default discovery 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=default2373 results
  • configuration=default&dsoType=item2348 results (25 collections/communities filtered out)

Fix (frontend only)

Add a reusable forcedDsoTypes input to the (themed) SearchComponent. When set, those DSpaceObjectTypes are forced onto every search request the component makes (they map to dsoType= query params on the REST discover/search/objects call), 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

  • Reusable, not hard-coded deep in the pipeline — any search surface can opt in, and it can later back a facet or a config toggle with almost no extra work.
  • Easy to revert / adjust — clearing SearchPageComponent.forcedDsoTypes restores the previous "all types" behaviour.
  • An explicit dsoType in 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} — set forcedDsoTypes = [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 --noEmit passes.
  • Added unit test covering the forced-types injection.
  • Backend behaviour confirmed live via the REST dsoType filter (counts above).

🤖 Generated with Claude Code

@Kasinhou Kasinhou self-assigned this Aug 26, 2026
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
Kasinhou force-pushed the clarin9/search-items-only branch from 484c30b to d468754 Compare August 26, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant