Pinned Update #1

The Darc Library (C++) is now updated as of March, 2012. Click ▷here too browse the entire solution.

Saturday, February 18, 2012

Multi-Label Search

Dear Google,

thank you for making me do this.

Anyway, i found a way to extend the Blogspot-Built-In search engine for labels. As you may know the URL www.[NAME][LABEL] will return all posts tagged with the respective label. Unfortunately it is currently (to the best of my knowledge) impossible to pass a combination of labels or to apply binary operators.

Luckily, such a feature is available for feeds using the feed URL www.[NAME][A]/[B]. This will give you the result corresponding to ([A] AND [B]), or in other words, all posts that are tagged with both labels. Also, the result will be formatted in XML so here's a list of all the stuff you need to do to get going.

XML Loader
Write a JavaScript function that will call the feed URL after appending the labels you're looking for.

XML Parser
Write another JavaScript function that receives the output of the XML Loader and parses the document for the pieces of information you need. Commonly, that would be the title, the author, the content, or a link to the actual post.

List Post
Publish a post on your Blog containing both functions and make the XML Parser load the formatted result into an empty <div></div> block. You're going to need a post for every new combination, or include a text box for dynamic search. This blog contains a number of such Multi-Label search posts, each tagged with the label "Proxy".

If you're too busy to do it yourself, just take a look at the code of one of the local posts tagged with the label "Proxy". Feel free to use the referenced scripts.

1 comment: