Weblog entry #122 for Steve
I've updated the site search to use Ajax.
Good? Bad? Useful? Pointless?
Just type a word like "virtual" into the search box to give it a go ..
Comments on this Entry
I personally prefer the additions of things like Ajax poll handling and comments before searches.
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
The thing about doing other things in Ajax is that they are more work...!
Comment handling, and poll submissions, should always work regardless of client so I'm reluctant to change them massively.
Things like the search addition are just nice little extras, which don't matter too much if they are broken or non-perfect.
I'll try to work on it a little more this evening and implement a couple of the suggestions which were left here. But if it turns out to be too slow still I'm happy enough to just write it off as a failed experiment.
I'm adding things like this because I think they would be kinda-useful, but if the drawbacks start outweighing the convience they'll just go. I don't see the need to make things Ajaxy just for the sake of it..
[ Parent | Reply to this comment ]
Typing "backup" yields this request:
http://www.debian-administration.org/search/suggest/b
"xen" fired these two requests:
http://www.debian-administration.org/search/suggest/xe
http://www.debian-administration.org/search/suggest/xe
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Exactly.
These URLs are used to return tags which have been set on articles which match the submitted text. (I could probably do a better job than just matching tags, but it seemed like a simple place to start with.)
The requests are fired onKeyUp so the timing and number of requests is a little random..
[ Parent | Reply to this comment ]
--------
Felipe Sateler
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Strange. I'll look into it.
[ Parent | Reply to this comment ]
Besides that, entering letters in Russian encoding results in a few seconds browser hang up, and then "Bad request!" "Error 400" suggestion box.
...Bye..Dmitry.
[ Parent | Reply to this comment ]
[ Send Message | View dkg's Scratchpad | View Weblogs ]
A couple notes that might make it more directly usable to me:
- set the cursor:pointer style on the individual elements in the list, so that it's clear they are clickable. (maybe also change color on hover)
- After clicking on the element, yawns fills the term into the search input box and clears the results field: that's good! But it would be better if it then also put the keyboard focus back in the search box, so you could press Enter to run the search.
- It's not clear to me when the results list actually refreshes. if i type "backu", sometimes it only shows "backups" and sometimes it shows "backports" and "backups" (as though it was only responding to the trigger for "back"). If you could track all outstanding AJAX requests and cancel them when a new trigger happens (onchange, i assume), that might work around this. (note: i haven't had a chance to dig through the code yet, so maybe yer already trying something along these lines).
- Once while playing with it (just once) i had an AJAX query not return at all and it seemed to freeze my browser while this was happening (or maybe it just froze that tab. i haven't been able to reproduce the behavior).
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Thanks for the comprehensive feedback!
set the cursor:pointer style on the individual elements in the list, so that it's clear they are clickable. (maybe also change color on hover).
Good idea. I will do that.
After clicking on the element, yawns fills the term into the search input box and clears the results field: that's good! But it would be better if it then also put the keyboard focus back in the search box, so you could press Enter to run the search.
Good idea again.
It's not clear to me when the results list actually refreshes. if i type "backu", sometimes it only shows "backups" and sometimes it shows "backports" and "backups" (as though it was only responding to the trigger for "back").
A new request is fired "onKeyUp", so it is a little arbitary. I think it will depend on the browser you're using, and how "busy" it is.
Once while playing with it (just once) i had an AJAX query not return at all and it seemed to freeze my browser while this was happening (or maybe it just froze that tab. i haven't been able to reproduce the behavior).
I've not seen that happen, but if it does I'll endeavour to fix it.
Mostly I regard these kind of Ajaxy things as not necessary, but kinda neat when they work. Thats why the commenting system which is something the site really needs isn't ajax because I am not sure I could do it right, and because I don't want to reject non-Javascript users.
[ Parent | Reply to this comment ]