500 errors on first few letters of typeahead search. Number of letters causing error is inconsistent
Problem Description
Entering typeahead values in the search form input at the top of the publiclab.org executes an AJAX call to the RESTful endpoint providing typeahead services. Entering the first few letters of the search value ("ab" of "abc" or "tra" of "trai") returns a 500 error on the RESTful call. Continuing to enter the value ("abc" or "trai") functions normally and as expected.
It has also been reported that there are high server loads, possibly from too-large a search result.
Recommended fix: Limit calls to 3 or more letters (industry standard), and attempt to optimize the search options to limit the values returned.
Relevant URLs
All publiclab.org URLs, since this is a form in the site template
PublicLab.org username
david-days
Browser, version, and operating system
Google Chrome Version 52.0.2743.116 m Windows 7
Testing bug fix now:
Added code to client side javascript to limit AJAX queries to 3 or more characters Added validation code to typeahead.rb RESTful service to validate query string length Added limit code to return top 5 matches of each typeahead query (5 for each tag, 5 for notes, 5 for users, etc. or 5 X each for the "all" query)
Looking good, @jywarren. If tests pass, will push this up very soon.
Solved in #733