You’ll probably get lost in this post. I should doodle a diagram… Apologies.
So today I’ve tasked myself with improving the search feature on the NexGen project (itself a post for another day), the scenario is this:
- A Company has Contracts
- Contracts are linked to Accounts and Primary Contacts
- Contracts are made up of Jobs
There may be hundreds or thousands of Jobs in the case of rolling contracts
- Jobs are linked to Sites and various other bits and bobs
The search should allow you to get you from the homepage to the exact piece of information you need based on the information at hand - you might have a Site Address, Client Name, Reference ID etc.
The search itself is fully functional, however I’ve not been 100% happy with the interface - until today! The old interface was pretty bog standard:
- Show a list of results that match the search criteria
- Don’t show results that don’t match the search criteria
Pretty simple right? Indeed, but the interface actually requires MORE components:
Lets say we searched for the Site: “Durham Castle” - it’s used by 2 Jobs within a single Contract. That Contract has other Jobs at different sites. If we only show those two Jobs then how do we see the other Jobs? We need:
- A show-all Jobs button
Not so bad right? Well, I think it is awful - the interface bit is OK, the coding bit is OK, but the users of the system have to be aware that “we’re only showing the Jobs that match your search” - it might not be obvious that there’s other Jobs in that Contract!!
So my solution is to show all the Jobs (well, paginated) but with the search results at the top. In the prime spot :-)
SELECT * FROM `jobs` ORDER BY site=22 DESC, id ASC;
I’m really happy with this one even if you don’t get it.