If you do any sort of software or web development, then those headslap/facepalm moments are probably more common than for most ‘ordinary’ people. They usually also involve utterances such as ‘So THAT’S why it doesn’t work?! How come I am SO DUMB?! How did I not notice that?! WHEN did I break that?! WHY did I not look into that, I should’ve KNOWN there was something broken’
Today has been one of those days. I have fixed a number of bugs, some of which have been present from the very beginning and some which I caused myself in an update well over a year ago.
Long keyword searches
One of the bugs involved long keyword-based searches getting truncated – I had only allowed for 32 search characters in the database field that stores the cache ID for the search, and because I was using a hashed version of the search query as a unique cache ID then if it got truncated to 32 chars it wouldn’t match the search any more and wouldn’t be retrieved! HOW, HOW was I SO DUMB?! So THAT’S why certain long title searches weren’t working! No WONDER I couldn’t just copy-paste a title from Amazon and search on it! 32 characters, really?! The limit has now been increased to 256 characters (even though Amazon’s limit is 200 characters anyway, but let’s be generous) and now you can search on:
and it will actually work!!
ASIN searches
Back when the site was launched, searching on an ASIN usually returned results (from Amazon mostly, of course), it was even promoted as a feature up below the search bar, now reinstated! You could type in an Amazon ASIN and get at least one product back from Amazon, including a UPC, so you could compare the price with other retailers (and now you can again!).
And then at some point I just felt it seemed unreliable – most of the time, in fact, ASINs were NOT returning search results. So I stopped promoting that as a feature and gave up on the idea. Wind forward like 18 MONTHS and I am using my debugging tools to start preparing for a big migration we have to do for Amazon (ugh, that’s a topic for another time) and I realise, wait, there ARE results being returned for ASIN searches, they just aren’t being displayed! To cut a somewhat long story short, at one stage, for display purposes I won’t get into, I was culling the first result that comes up in any search. Except on an ASIN search you typically only HAVE one result, and if you cull that then you have, er, zero results. How come I am SO DUMB?! HOW did I not notice that?! etc. etc. So now you can do ASIN searches, and life makes sense again.
Other bugs
There was one other bug that involved keyword searches NOT returning any UPCs from Amazon. All the Amazon results would be lumped under ‘Matching products we don’t have UPCs for, sorry…‘ heading. WHY did I not look into that, I should’ve KNOWN there was something broken (etc. etc., choose 2 more self-deprecating utterances from the list above)?! Well, now Amazon products return UPCs too – they were not being properly parsed from the Amazon API, my mind is blown how that could not be working (add more utterances).
So, my face has been thoroughly palmed today, but now the site functionality is a WHOLE lot better. Now all we have to do is migrate to the new Amazon v5 API, like, YESTERDAY, that will break everything all over again, hooray.