learningequality/ka-lite — pull request #829 by bcipolli (2013-10-14 12:44:33+00:00)
Title: Set a max # of results, to avoid churn on the server.  Configurable (but not currently exposed)

Issue:
* Blank search string, or generic ("a") search string, could churn the server--even if accidental
* Missing search would redirect to the homepage--could be confusing.

Changes:
* Limit searches to a configurable number (default: 25)
* Notify the user (print a message in each header, add "..." to bottom of results) when that limit has been hit
* Show an error when no query was passed

Notes:
* Still not efficient enough on the client, nor server sides:
* Clients should persist (if possible) the flat_topic_tree dictionary (takes a lot of time to compute). Otherwise, we'll have to disable by default (to avoid slow loading on every page for weak clients, like tablets)
* Server should cache l-cased titles during the first search. Re-computing on every search uses CPU, whereas memory is still much cheaper.

PR Help requests:
* @aronasorman please take a look. Take a look at the styling of code as well, some style differences that we're trying to make uniform (spaces instead of tabs, indenting style for dictionaries, function calls, etc)