django-haystack / django-haystack/django-haystack

Unnecessary code in SearchView.build_page

Open
#900 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs review
Dominant language
Python
Stars
3.7k
Forks
1.3k
Avg merge
3h 18m
Merged PRs (30d)
3

Description

Lines 106 and 107 seem to be defunct.

start_offset = (page_no - 1) * self.results_per_page
self.results[start_offset:start_offset + self.results_per_page]

https://github.com/toastdriven/django-haystack/blob/3502b93671de910f60d6a3651704fe77d5d42f9c/haystack/views.py#L106-L107

The resulting slice isn't used. Is it there to determine if there are results for this page, because paginator already handles this?

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

Start in haystack/views.py at lines 106-107 within SearchView.build_page and inspect how the paginator handles the page. Confirm that the slice result is unused, then remove the defunct code and verify that pagination behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
search
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.