A quick Quick Search

Previously for our Hack Days, I’d been inspired by technical issues that are more commonly known as ‘Technical Debt’. Usually these are things that prevent me from being able to deliver features to the business. For example, a mechanism to black-box test our Order Importer, which later came in very handy as part of a significant project that happened about a year after writing that code. Good job that code wasn’t thrown away!

Our next Hack Day was fast approaching, and I didn’t feel there were any obvious quick hacks that I could provide a proof-of-concept for in two days, especially on my own. So I had a nosey at the wiki page that had been set up for people to post their ideas, and possibly draw in some interest and extra hands. This entry at the top (with the head of IT’s name beside it!) caught my eye:

I’d like to have a quick search box in the header of [an internal application] which allows me to enter an ORDER_ID or CUSTOMER_ID or PRODUCT_ID and press 1 button and jump straight to that item. I spend too long navigating to search pages and results pages. I want to type in an ID and go straight there. Was thinking a single text box and then 3 buttons, Order, customer, product. (oh and same for [other internal application] but just for product)

The idea is really simple. No, I mean really simple! So simple I was confident I could get a proof-of-concept ready for demonstration in less than a day.

The suggestion of a Quick Search box has been mentioned for as long as I’ve been here (that’s well over five years). It just never seems to be a business priority. There are always more business (value) orientated projects to be undertaken. And from a technical point of view, there are always more interesting things with more technical benefit to pick up. Despite these circumstances I repeatedly hear the desire for this from users in our warehouses, testers, developers and business analysts.

Given the demand for it, and what with it being so simple, I thought I might as well take it on, even if I didn’t believe I’d be in the running for a prize. In my head, the pretty or the customer-centric ideas were the ones that would grab all the attention.

I had a ponder about the description on the wiki page, and I reduced the idea to ‘quickly search useful things’. I did away with the different buttons for different types of search. The editor I use (vim), and another Unix-based editor, rely heavily on keyboard commands, which becomes a very efficient way of controlling a system once you become familiar with it. No need to operate a mouse! So I wanted to be able to indicate that I want to enter a command, and then for me to just enter the command with the search term. I chose the Alt-? as a keyboard shortcut to get focus to the input box I had added at the top of the page.

Now to make it do something useful. Creating a handler was easy, even easier as our internal application is built on Catalyst. It was done without cut and paste of boiler plate. I knew there were already a few search pages in another internal application, but they provided lots of drop downs and text boxes to refine the search. We just want to do a quick search here. So taking a list of what I thought to be useful searches I allocated a letter to each.

  • o – order num – ‘o 12345’
  • p – product id – ‘p 37308’
  • s – shipment id – ‘s 245789’
  • e – email – ‘e jason.tang@net-a-porter.com’
  • n – customer name – ‘n Jason Tang’

Now I’ve got all these commands I can easily search for any of them.

What about if they don’t know what they’re looking for? This became the default behaviour if none of the recognised commands were used. A quick database call determines if there are any results. If there are, they’re listed on the page with links to click through to the actual search.

That’s it!

This simple, non-shiny text box some how grabbed the CEO’s attention during the demonstration/presentation part of the Hack Day, and he asked a question, which I thought he had already answered with the question itself. It was something along the lines of: “…and this search facility will save everyone using the system time by not having to click through to the search pages?” I guess he was highlighting to me the business value that he recognised in it, that I had not mentioned in my demo. Silly me!

Thanks to our CEO for seeing the potential of this small insignificant search box and making me one of the Hack Day winners.



Print Friendly
This entry was posted in Hack Days, Perl by Jason Tang. Bookmark the permalink.

About Jason Tang

Jason Tang has been with the company since 2007 where he joined as a Perl developer and has recently joined Web Ops on a secondment to gain special powers. Prior to joining net-a-porter he had been known to program in Perl, C, C++, Java and some other less well known languages like Scheme.

Leave a Reply