As per specifications we are given links to test return of JSON data for our search requests.
But staff's solution doesn't pass them. Check, only first one returns something.
I've designed solution (I can show if asked and it is reasonable to show), that passes all of them and even more sophisticated requests.
- It parses q request into separate words, irrelevant of separation via space or commas
- It accounts for situation when user input middle of word or when place name consists of two or more words (otherwise, if you search for New Haven and Haven is separate word in Select it wouldn't return New Haven because it counts them as single string. And it doesn't seem reasonable to implement separate moduls to check which part of q entry might be related to city name, which is to state, etc).
- It clears out with each Select by each word only those results that satisfy everything user entered (i.e. if he wrote New CT it will show all places with New in it's name located in CT, similar with Haven CT).
Basically it makes SELECT statements for each word user entered and cross-references everything, leaving in final list only items that appear in every SELECT statement.
But... It takes too long to execute, so it results in suboptimal user experience. it can take 10 or more seconds before any suggestion is shown.
So I have two questions: - Shall I disregard tests that requirements suggest and make sure my solution gives same results as staff's one? - Is there any way to make less computationally exhaustive search that still will work for Okay user experience. May be you can give me some reference what to read or to learn to get better in such tasks?