[Web4lib] creating a dynamic search box

Norwood, Randy randy.norwood at ttu.edu
Mon Jun 15 16:57:57 EDT 2009


I've done this in a couple of different applications. Basically, you use AJAX to capture each keystroke and send it to the remote server's database. For example, if you type "S," it might cause a query to be executed similar to "select top 10 words from wordIndex where words = 'S%' and those 10 results would populate the dynamically generated dropdown list. Then if you typed "h" it would send the query "select top 10 words from wordIndex where words = 'Sh%'" and so forth.

An important decision is how the "wordIndex" is created. It could be a keyword index of the field(s) of interest (say, book titles). It needs to be reasonably complete, but not so large that responsiveness is slowed.


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Randy Norwood
Programmer/Analyst III
Texas Tech School of Law Library
E-mail: randy.norwood at ttu.edu
Office: 806-742-3990 x350

-----Original Message-----
From: web4lib-bounces at webjunction.org [mailto:web4lib-bounces at webjunction.org] On Behalf Of Michelle Gerry
Sent: Monday, June 15, 2009 10:47 AM
To: John Fitzgibbon; web4lib at webjunction.org
Subject: Re: [Web4lib] creating a dynamic search box

I bookmarked this site recently that explains how to do it:
http://woork.blogspot.com/2008/03/php-components-autosuggest.html 
 
I haven't tried to implement the steps yet, so I can't say if it is
useful or not, but it's worth looking at.
 
 
_,.-:*'``'*:-.,_,.-:*'``'*:-.,_,.-:*'``'*:-.,_ .-:*'``'*:-.


>>> On 6/15/2009 at 11:25 AM, in message
<45751448A71EAC43962D93D2E8FD46070BF3D72361 at GCC-EXCHANGE07.galwaycoco.ie>,
John Fitzgibbon <jfitzgibbon at Galwaylibrary.ie> wrote:
Hi,

Google, Amazon and Ebay all use a dynamic search box. As you type
characters into the search box, words from a database which match what
has been typed appear as suggestions.

How is this achieved? I know it depends on JavaScript. When JavaScript
is disabled it stops working. It also needs a live connection to a
database. When working offline the dynamic search box stops working.

Are there any websites which discuss this feature in more detail?

Any help would be much appreciated.


Regards,

John



John Fitzgibbon



w: www.galwaylibrary.ie 

e: info at galwaylibrary.ie 

p: 00 353 91 562471

f: 00 353 91 565039


#####################################################################################
This e-mail message has been scanned for  content and cleared 
by MailMarshal Hosted  at Galway County  Council

Tß an teachtaireacht rφomhphoist seo scanßilte dÆ┴bhar agus glanta 
ag MailMarshal atß ╙stßlta i gComhairle Chontae na Gaillimhe.

Correspondance is welcome in Irish or in English.
Tß mφle fßilte roimh chomhfhreagras i nGaeilge n≤ i mBΘarla.

Tß eolas atß prφobhßideach agus rnda sa rφomhphost seo 
agus aon iatßn a ghabhann leis agus is leis an duine/na daoine
sin amhßin a bhfuil siad seolta chucu a bhaineann siad. 
Mura seolaφ th, nφl t daraithe an rφomhphost n≤ aon iatßn 
a ghabhann leis a lΘamh, a ch≤ipßil nß a sßid. 
Mß tß an rφomhphost seo faighte agat trφ dhearmad, 
cuir an seolt≤ir ar an eolas thrφ aischur rφomhphoist 
agus scrios ansin Θ le do thoil. 

This e-mail and any attachment contains information which is 
private and confidential and is intended for the addressee 
only. If you are not an addressee, you are not authorised 
to read, copy or use the e-mail or any attachment. 
If you have received this e-mail in error, please notify 
the sender by return e-mail and then destroy it. 

If you need this email in an alternative format please contact the
sender
Mß tß an rφomhphost seo ag teastßil uait i bhformßid eile dΘan
teagmhßil leis an duine a sheol chugat Θ

#####################################################################################
_______________________________________________
Web4lib mailing list
Web4lib at webjunction.org 
http://lists.webjunction.org/web4lib/ 

_______________________________________________
Web4lib mailing list
Web4lib at webjunction.org
http://lists.webjunction.org/web4lib/



More information about the Web4lib mailing list