Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Results should be loaded using fewer REST requests #3163

Open
tdonohue opened this issue Jul 3, 2024 · 3 comments
Open

Search Results should be loaded using fewer REST requests #3163

tdonohue opened this issue Jul 3, 2024 · 3 comments
Assignees
Labels
affects: 7.x Issue impacts 7.x releases affects: 8.x Issue impacts 8.x releases bug component: Discovery related to discovery search or browse system performance / caching Related to performance, caching or embedded objects

Comments

@tdonohue
Copy link
Member

tdonohue commented Jul 3, 2024

Describe the bug

In 7.x and 8.x, when a user searches the system, this makes many calls to the REST API to load all the required information to display on the search page. Currently, it first loads the results, then each facet (one by one), then any thumbnails and "accessStatus" (if enabled). We should be able to decrease the number of calls made on this page.

Here's what it looks like on the sandbox.dspace.org in Chrome DevTools when running a search on "test":

# Run Actual search
GET /server/api/discover/search/objects?sort=score,DESC&page=0&size=10&query=test&embed=thumbnail&embed=item%2Fthumbnail&embed=accessStatus

# Load each facet one by one
GET /server/api/discover/facets/author?page=0&size=5&query=test
GET /server/api/discover/facets/subject?page=0&size=5&query=test
GET /server/api/discover/facets/dateIssued?page=0&size=5&query=test
GET /server/api/discover/facets/has_content_in_original_bundle?page=0&size=5&query=test
GET /server/api/discover/facets/entityType?page=0&size=5&query=test

# Load thumbnails for each returned item
GET /server/api/core/items/[uuid]/thumbnail
...

# Load accessStatus for each returned item
GET /server/api/core/items/[uuid]/accessStatus
...

We should be able to minimize the number of calls here by using Projections (embed parameter). It may still be necessary to load thumbnails individually though.

To Reproduce

Steps to reproduce the behavior:

  1. Visit demo.dspace.org or sandbox.dspace.org
  2. Open Chrome DevTools
  3. Run a search. Verify that you see a large number of REST requests to build the search results page.

Expected behavior

Ideally, better usage of projections should allow us to load all this information in fewer REST requests. If additional endpoints need to be added to the REST API to support this behavior, then we should add them.

@tdonohue tdonohue added bug component: Discovery related to discovery search or browse system performance / caching Related to performance, caching or embedded objects affects: 8.x Issue impacts 8.x releases affects: 7.x Issue impacts 7.x releases labels Jul 3, 2024
@paulo-graca paulo-graca pinned this issue Jul 4, 2024
@paulo-graca paulo-graca unpinned this issue Jul 4, 2024
@paulo-graca
Copy link
Contributor

Related issue: DSpace/DSpace#9316

@ybnd
Copy link
Member

ybnd commented Jul 5, 2024

We've investigated the repeated /thumbnail and /accessStatus requests before and concluded that they were due to mis-caching of empty/nonexistent embeds. Could contribute a fix.

@tdonohue
Copy link
Member Author

tdonohue commented Jul 9, 2024

@ybnd : If you have a fix in place, that'd be wonderful. I think this is related to DSpace/DSpace#9316 which I see is also assigned to Atmire. So, both might be fixed in one PR.

Assigning to you & moving to "in progress"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: 7.x Issue impacts 7.x releases affects: 8.x Issue impacts 8.x releases bug component: Discovery related to discovery search or browse system performance / caching Related to performance, caching or embedded objects
Projects
Status: 🏗 In Progress
Development

No branches or pull requests

3 participants