OPAC spelling suggestions using Yahoo! webservice JSON (no PHP required)
Tags: aleph , basic , javascript , json , opac , api , spelling Last Updated: Oct 30, 2009 00:57
- Description
We can't use PHP, so I've developed this code to read the JSON return from Yahoo! Spelling suggestion service. Suggestions are returned following a search that has 0 hits and then made clickable. However, it could in theory be entered anywhere a search variable is passed.
- Author: Mark Watmough
- Additional author(s):
- Institution: Napier UniversityEdinburgh Napier University
- Year: 2009
- License: BSD style
- Short description: Use, modification and distribution of the code are permitted provided the copyright notice, list of conditions and disclaimer appear in all related material.
- Link to terms: [Detailed license terms]
- Skill required for using this code:
basic
State
Stable - We have had it working on our production server for over 6 months.
Programming language
Javascript
Screen captures

Author(s) homepage
Download
http://www.exlibrisgroup.org/download/attachments/22905672/YahooSpellingSuggestions.txt
Working example
http://nuin.napier.ac.uk/F/?func=find-e&request=library+management+systms&find_scan_code=FIND_WRD.
Installation instructions
- Read Yahoo!'s guide and then register for an APPID here - http://developer.yahoo.com/search/web/V1/spellingSuggestion.html
- Copy code attached/below and place in the web files as appropriate (we used find-e-head and find-b-permute head as these are seen after '0' hits are returned for a search)
- Replace the <REPLACEME> text (shown below) with your APPID obtained earlier. Also the '<a href=>' will need to be replaced to link to your catalogue.
- Restart www_server and test it out!

Only one suggestion is ever returned. If Yahoo! returns no suggestion, nothing is shown 
Please note: The code above and attached is currently nested in a table.
TO DO list
None...yet.
Known issues
Suggestions are sometimes held on the local cache
Comments
Text...


12 Comments
comments.show.hideApr 11, 2009
Rodrigo Calloni
Hi Mark
That's great! I implemented it right away in our test new OPAC.
I am implementing lots of stuff and as soon as the new OPAC is released I will post to our community. I hope to release an Ipod Touch/Iphone OPAC compatible... It is looking good so far.
The link to the PC OPAC is the following
http://iadb.exlibrisgroup.com:8991/F?func=find-b-0&local_base=fhl_new
If you have any questions I can answer
Best regards,
Rodrigo
Apr 14, 2009
Mark Watmough
Hi Rodrigo,
I'm happy to hear that you implemented so quickly! The iPod touch/iPhone compatible OPAC is something that we would be very interested in hearing more about - please keep me posted!
Thanks,
Mark.
Apr 15, 2009
Rodrigo Calloni
I am just finishing the last adjustments of the ipod/iphone html pages and I will document it before we release to our users. I will create a topic for this here too
See you Mark
Apr 15, 2009
Timm Siewert
Hi Mark,
thanks a lot for this! What about the other nice features you´ve inplemented in ALEPH?
Best,
Timm
Apr 17, 2009
Anoop Atre
Hi Mark,
Thanks! I was just looking into doing it on my own when I decided to check here first : ) I like the JSON idea better than PHP, keeps things simpler.
I wonder if the 5000 Queries Per Day limit has been a problem? They say 5000/IP/Day...is it the server IP (OPAC) or the client since Javascript is running in the user's browser, I'd guess client but maybe it's based on the App Id.
One option I was considering was using the Yahoo! Search BOSS service but they plan on charging per query soon which might not work for us.
> http://developer.yahoo.com/search/boss/fees.html
> http://tech.groups.yahoo.com/group/ysearchboss/message/1713
Apr 22, 2009
Mark Watmough
Hi Anoop,
Thanks for your comments. No, the 5000 searches per IP limit has not been a problem for us as we only query Yahoo! when a search has returned zero results.
I think, as you suggest, that it may be per client IP ("Access is rate limited based on the caller's IP address, and queries are limited per IP and per day.") although it certainly isn't very clear.
Mark.
May 07, 2009
Ying Ling Wang
Hi, Mark
Thank you for sharing. It's great.
I can do it well because your clear explanation.
Thanks a lot.
Our WebOPAC in Chinese: http://webpac.lib.nthu.edu.tw/
Our WebOPAC in English: http://webpac.lib.nthu.edu.tw/F?func=find-b-0&local_base=top01&CON_LNG=eng
Best regards,
Joe
Taiwan, R.O.C.
May 12, 2009
Mark Watmough
No problem Joe. I'm pleased you found it easy to implement!
Best wishes,
Mark.
Jun 01, 2009
Anoop Atre
Did ExLibris remove the http://www.exlibrisgroup.org/download/attachments/22905672/yahooJSON.txt file?
Might have been a mistake, seems like they've replaced it with an internal doc. Tsk Tsk. : )
Jun 03, 2009
Mark Watmough
It looks as though they did :'o(
I recommend that you copy the code in the 'installation instructions' section rather than try and find the original attachment!
Jul 14, 2009
Thomas McNulty
Thanks for posting this! It was quick and easy to setup in our OPAC. I made a slight change to retain session IDs, other than that it copy + paste-tastic.
Aug 03, 2009
Mark Watmough
Pleased to hear that Thomas!
Also, I've reattached the document that was written over by ExLibris (See previous comments). This really wasn't a big problem as it is identical to the script in the installation instructions.