2

I have an app that will allow you to lookup the salaries of public officials. I have a few multiselect boxes to narrow the search by role and department. I am thinking about how to design the name search.

Are there clear best practices? Should I have a first and last name field? A single name field that lets the user enter in any name? What SQL logic should I connect to the input fields to the database? Should I do a "like" search to return all of the rows that might match the person?

It seems like the ideal thing would have something like a google search box that returned all possible hits on first and last name. There are only 3k rows in the DB so this seems feasible.

  • Start doing the search when you think you have enough characters to get a meaningful result. e.g. do the search after the user type 3 letters such as "Joh", "Ken", etc. + Use Auto-complete (retrieving small number results). That will give you a great performance. – Jaider Jul 23 '14 at 21:24
1

We have the same challange in a different environment where we use search heavily. Apart from sorting every column from A-Z and Z-A we also have an "onKeyUp" filter active from chracter no three.

This means that the user just has to enter three characters to filter content on any column. This is technically not "search" per se, but the experience is the same as Google Instant Search. And that's what counts.

So I'd stick to the more familiar term "search" instead of "filter". At least this is what we do, and our customer is happy with it :-)

0

What i would do is make a single text input the main search element, and hide all the other stuff inside a collapsed menu.

SQL-wise you're not looking for a 'like' search, but fulltext searching using MATCH() ... AGAINST(), and get those results back in real-time using AJAX/jQuery.

Another thing you could try is using HTML 5's datalist. Basically, you send all the names in the database with the page when it's loading, eliminating further roundtrips to the server. This gives you instant response, not instant-ish as dynamically loading suggestions could provide.

Just be sure to thoroughly test if this approach does not affect page loading speed too much, and bear in mind that browser compatibility is good, but not perfect.

0

Think Google. One search box with incremental filtering/autocomplete!. If you can even include personnel pictures along with the results, even better. It's quick and effective.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.