Editor's Note: YDN developer mich Cook has tried to make his inline comments clear enough that this sample code is self-explanatory. In trying to write the blog, he felt he was essentially duplicating the inline comments. We'd love to hear back from you: Were the inline comments enough, or would you have preferred a more detailed overview? Leave a comment below!
Our docs team needed a module that supports searching within a set of documentation, and I came up with this solution. It took me about a day to implement this, test it, and integrate it into our doc build process.
To create a contextual search box that will work on our documentation set, I used the following technologies:
- Yahoo! User Interface 3 (YUI3)
- YUI3 gallery
- Yahoo! Query Language (YQL)
- a search parameter that's probably lesser-known
Now, of course, it will take a little while to roll it out across all the docs. However, you can already see one of the first docs where the contextual search box went live at the Yahoo! Social API Reference.
For those reading this in an RSS reader, you can see the code on github.