internetarchive / internetarchive/openlibrary

Clicking carousels title link, e.g. "Trending", on Home Page results in confusing populated query

Open
#13,501 5 comments 0 reactions 0 assignees View on GitHub
Affects: UI Lead: @cdrini Module: Solr Needs: Breakdown Needs: Response Needs: Staff Decision Priority: 4 Theme: Search Type: Bug
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 19h
Merged PRs (30d)
138

Description

### Problem

When navigating to Trending Books on OpenLibrary, the internal query used to generate trending results is exposed in the search input.

Additionally, -subject:"content_warning:cover" appears twice in the generated query. The query can also reappear after clearing the search input and changing the sort/filter (e.g. from Trending to Random or First Published).

This makes the search input confusing for users and may indicate that the internal trending query is being incorrectly persisted or merged into the user's search query.

Image

### Reproducing the bug

1. Go to https://openlibrary.org/
2. Click Trending Books.
4. Observe that you are redirected to a search URL similar to:
- https://openlibrary.org/search?q=trending_score_hourly_sum%3A%5B1+TO+%2A%5D+readinglog_count%3A%5B4+TO+%2A%5D+language%3Aeng+-subject%3A%22content_warning%3Acover%22+-subject%3A%22content_warning%3Acover%22&sort=trending
8. Observe the search input. It contains:
- trending_score_hourly_sum:[1 TO *] readinglog_count:[4 TO *] language:eng -subject:"content_warning:cover" -subject:"content_warning:cover"
9. Clear the query from the search input.
10. Change the sort/filter from Trending to Random or First Published.
11. Observe that the following query appears again in the search input:
- trending_score_hourly_sum:[1 TO *] readinglog_count:[4 TO *] language:eng -subject:"content_warning:cover" -subject:"content_warning:cover"
Changing the sort/filter again can cause the same internal query to persist/reappear.

* Expected behavior:
* Actual behavior:

### Context

- Browser (Chrome, Safari, Firefox, etc): Brave
- OS (Windows, Mac, etc): Fedora
- Logged in (Y/N): Y
- Environment (prod, dev, local): prod

### Breakdown

Implementation Details (for maintainers)

#### Requirements Checklist
* [ ]

#### Related files

*

#### Stakeholders

*


#### Instructions for Contributors

- Please [run these commands](https://docs.openlibrary.org/developers/tools/git.html#working-on-your-branch) to ensure your repository is up to date **before** [creating a new branch](https://docs.openlibrary.org/developers/tools/git.html#making-changes-and-creating-a-pull-request) to work on this issue and **each time after** pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the flow from the OpenLibrary home page through Trending Books, then inspect the search input after clearing the query and changing the sort/filter. Done means the internal trending query is not exposed, duplicated, or restored after those interactions, while the selected search and filter behavior still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.