Cache Me If You Can
On Monday I wrote about the phenomenal flexibility that custom fields offer in Conversant. But such metadata fields wouldn’t be much use without a sophisticated way to search those fields and present the results. The system already had a very powerful searching feature which recently received some major enhancements.
The first enhancement is that search results can now be cached. For example, take a look at a search page about the 9/11 terrorist attack. This is basically just a glorified search page that finds all the articles that have a “9/11″ keyword and displays them in reverse chronological order. Since the articles on this page aren’t going to change that often, I have set this page to show a cached version of the search rather than perform the search anew every time someone access the page. In this case I’ve set the page up to keep the cached version around for at least 24 hours. This provides an enormous increase in speed, especially in pages that return a lot more results than this 9/11 page does.
The second enhancement is a new macro that allows me to insert the results of a search into a message. Let me back up here. The main building block of this site are called messages. Each essay or post on the site is a message which has a title, a date, an author, etc. This searching I’m talking about, however, is done through a separate page type that is not associated with a message. So, if I wanted to have a brief explanation about the terrorist attack before the list of articles, I would have had to either write it directly in the page template of that search page, or alternately (which I tended to do) I could create a message with the description and then use an insert message macro to automatically place the description at the top of the page.
A better solution is the new InsertQuery macro which allows me to insert the results of a search into a message, as well as make some minor modifications to how the search results will display.
For example, take a look at the message version of the search page. At the moment this message is simply one line that says, “insert the results from the search page into this message.” Because the search page is set for caching, I told the InsertQuery macro to use the cache as well (I could override this and force it to do a fresh search if I wanted to). Since I’m going to need to alter the text of this page more than I am going to need to alter the search criteria, this is a tremendous help — especially on sites where I’ve got dozens of these and the introductory text is, in some cases, an essay rather than just a short paragraph.
There are some other neat thinks that can be done with this InsertQuery macro. I was reading Jakob Nielsen’s book, Designing Web Usability: The Practice of Simplicity, recently, and one of the things he mentioned that I really liked was the use by some sites of small boxes in the right hand side of the page that listed related stories. So a story about a new Maxtor hard drive on ZDNET might have a little box that includes links to other recent stories about Maxtor.
The InsertQuery macro has a feature that lets me limit the number of results returned. So, even though the 9/11 search page is set to return as many as 999 results, when I insert those results into a page, I can tell it just to return the first 5 or 10 or 50. This makes it easy to do a “Related Stories”-style box.
If you read my story about pacifism, for example, you’ll see a list of five other stories related to the 9/11 attack there (it doesn’t look very pretty because I whipped this up in just a few minutes, but it’s got potential).
Plus, here is where the whole architecture of the system comes into play, there is an easy way for me to do this on a regular basis. If I had to remember to type in the HTML code for that table every time (and remember to type it in slightly different versions for every other topic as well) I’d quickly give up. But Conversant includes something called Resources, which let me build text short-cuts, which seriously reduces the pain. In this case I made a resource called “recent_911.” To insert that box in any articles I write related to the 9/11 attack, I simply type |recent_911|, and the software takes care of the rest.
Now that’s powerful.
Tags: Conversant
