Skip to content

Pager with search queries #950

Description

@natanfelles

I'm trying to paginate model results by a GET query:

On the first search the URI is:

/search?q=you+alice+to+the+little

When clicked to the page 2 in the link generated by the Pager of Model paginate(), it becomes:

/search?q=you%2Balice%2Bto%2Bthe%2Blittle&page=2

Going to the third page, it becomes:

/search?q=you%252Balice%252Bto%252Bthe%252Blittle&page=3

I was able to manipulate the string to get the data in the database with:

$search = $this->request->getGet('q');
$search = urldecode($search);
$search = str_replace('+', ' ', $search);
var_dump($search);exit;

Then all inputs will return the same string: 'you alice to the little'.

This issue is related to the pagination links, that every time encode the, already encoded, query string.

On page 5 it becomes:

/search?q=you%25252Balice%25252Bto%25252Bthe%25252Blittle&page=5

On page 6:

/search?q=you%2525252Balice%2525252Bto%2525252Bthe%2525252Blittle&page=6

I tried to manipulate it with:

$search = str_replace('%2B', ' ', $search);
$search = str_replace('%252B', ' ', $search);

But as the page number increases the URI is re-encoded and a new override is needed to keep the original string.

I would open this question in the forum, but I think it is more related to how pagination works at the moment.

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions