Closed Bug 336598 Opened 18 years ago Closed 18 years ago

Search result page redirects to addon page incorrectly

Categories

(addons.mozilla.org Graveyard :: Public Pages, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: cameron, Assigned: justdave)

References

()

Details

Attachments

(1 file)

If you search and find 10x+1 addons (ie. 11, 21, 31 etc,) the "next page" link on the second to last page will take you directly to the last addon's listing page, rather than to a search page showing the final item.

This is because if you search and only find one addon, it automatically redirects you to that addon.

Of course if you manually select a different number of addons per page, then this bug will occur with other numbers of addons in the results.

To reproduce:
1) Go to https://addons.mozilla.org/search.php?app=firefox&q=rss&perpage=10&left=20 - as of when this bug was filed, there are 31 results. This will of course change in future.
2) Click "next page" 
3) Be redirected to one addon's page

Expected results: Show a search page with only one item on it, including a "previous page" link.
Attached patch Patch v1Splinter Review
This is completely untested, but looks like the right thing to do...
Assignee: nobody → justdave
Status: NEW → ASSIGNED
Attachment #221253 - Flags: first-review?(morgamic)
Comment on attachment 221253 [details] [diff] [review]
Patch v1

Should be:
// If we have only one result, redirect to the addon page.
if ( $resultCount == 1) {

It was pointing to the wrong count (and an expensive one at that!).  The $resultCount variable holds the number returned by "SELECT FOUND_ROWS()" which gives us the overall # of records (not just the # of list items in the actual result set to be used for the template).
Attachment #221253 - Flags: first-review?(morgamic) → first-review-
Tested this fix, committing shortly.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: