django-haystack / django-haystack/django-haystack

Paginator does not work well with facets

Open
#1,132 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The paginator used in SearchForm does not work well for faceted queries, since it does not do anything useful when a facet is added that causes the number of pages of results to be fewer than the number of the page that the facet was added from. Eg, on the second page of results, the user follows a link to add a facet (which simply appends &selected_facets=facet:value to the querystring) and if there is only one page of results, then terrible UX ensues.

Replacing SearchForm.build_page with the example view code from recent Django documentation solves this problem.

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 at SearchForm.build_page and compare its pagination behavior with the recent Django documentation example mentioned in the issue. Reproduce a faceted query from the second results page where the facet reduces results to one page; done means the resulting pagination no longer leaves the user on an invalid page.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.