Fuzzy Pagination

Have you ever been browsing a website, viewing a list of items, and had it display 20 out of 21 items?  Don’t you just love clicking the “next” button to see one more item?  I don’t.

Pagination – the idea of breaking up data into pages of a set length – is often necessary.  When querying data, and not knowing exactly how much data is going to come back, you need to put a limit on things.  Imagine searching Google, and it loading up a web page with all 550,000+ results for “discount Koala meat”.  I’m pretty sure that would crash any browser – especially on a memory/CPU limited mobile device.  So rather than returning all results, it breaks the search results into pages of a reasonable size.  But what is a reasonable size?

One frustration I have with sites like Amazon.com is that they will display page sizes of 20 items or so.  But what if my query returns 21 items?  Do I really want to make the user click the “next” button to see a single item?  What if they want to see items on both pages at the same time?

Situations like this make me want to implement some form of fuzzy pagination.  If n is the page being requested, we examine page n+1 (if it exists).  If page n+1 does exist and is the last page, and the number of results on page n+1 is <= 50% of the page size, we return the results as part of the request.  If any of the above conditions fail (there is no next page, or the next page is >50% the size of a regular page), we don’t do anything special – we just return the regular sized page.

It’s features like this that are almost completely transparent to the end user, but make it that much better of a user experience.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s