openlibhums / openlibhums/janeway

Duplicates in site search

Open Beginner friendly
#3,980 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Size S
Dominant language
Python
Stars
239
Forks
97
Avg merge
9d 1h
Merged PRs (30d)
8

Description

Describe the bug
A clear and concise description of what the bug is.

There are some duplicate search results around redirected URLs. For example:

  • /site/plugins/supporters/referrals/codes/#library-partnership-fees
  • /site/consortium/#library-partnership-fees
  • /site/for-librarians-consortia/#library-partnership-fees <-- the correct one

image

Janeway version
1.5.2

Expected behavior
A single seaerch result per piece of unique content

Proposed solution
Add the requests.response.url to the fetched_urls, in addition to the requested URL, here:

https://github.com/BirkbeckCTP/janeway/blob/c6a13f7c4e6562a2e453f35deea8ebbaa743ad94/src/cms/logic.py#L210-L215

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read src/cms/logic.py around lines 210-215 and trace how requested and redirected URLs enter fetched_urls. Reproduce the example search using the three listed URLs; done means redirected URLs no longer create duplicate results and one result remains for each piece of unique content.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.