Title photo
Ode is simple! (Simple means that you know how it works.)

Hello, and welcome to news.ode-is-simple.com.

This is a weblog dedicated to Ode (ode-is-simple.com) and other topics relevant to the project.

If you're looking for general info about Ode you may want to start at the project homepage at ode.simple.com/home

To stay up to date with the newest news and info related to Ode, subscribe to this site's RSS 2.0 using Google Reader or your preferred feed reader.

Posts

Sun, 09 May 2010

A preview of the Indexette addin

I've recently finished an addin for Ode called Indexette that I think is an important one.

Indexette is a nice example of a simple solution to an important (to this project) problem. Like Ode itself, there is nothing complicated or hard to understand about Indexette.

It's also a good demonstration of Ode's tags.

I've created a video overview of Indexette demonstrating what the addin does, and how it's used. The video is in two parts and about runs for about 10 minutes in total. If you're interested Ode, I think you'll agree it's worth seeing. If you watch the video you can skip the written instructions. (See, you don't have time not to watch.)

Intro to Ode's Indexette addin Part 1

Intro to Ode's Indexette addin Part 2

As you may already know, Ode uses the filesystem as a content database. Posts (i.e. the content of the site) are discrete text files that exist under the site's document root. On it's own, Ode traverses the filesystem examining the post files to find which are suitable for a given request. It then builds a page to return to the client by combining the content of these posts with a theme, which dictates the look and layout of the site.

This arrangement works quite well, however there are a couple of inherent issues.

First, traversing the filesystem looking for posts, and repeating the process for each request is time-consuming. Of course this is all relative. The system may only take a fraction of a second to process a request and serve the resulting page. This is an insignificant amount of time in comparison to how long it takes to transmit the original request and the resulting HTML page However, we have to consider the possibility of receiving multiple simultaneous requests, and so we should be as efficient as possible. Reading and writing to a hard drive is a relatively slow operation which involves not only negotiating the filesystem to locate the files, but also mechanical delays related to the operation of the drive itself, and contention among multiple processes all competing for the same resources.

Indexette builds an index identifying all of the content of a site. The script can then identify posts which are appropriate to each request by reading only a single file (the index), rather than working through every post file on the site. After the script identifies content that matches the request, it can directly target only those posts to retrieve the content needed to satisfy the current request.

Indexette also addresses another key issue, namely the fragility of post dates.

On it's own, Ode uses the modification dates of the corresponding files as post dates. This is a simple solution and works well enough if you are meticulous about how you work with your post files, so that these modification dates don't change unexpectedly.

The modification time is updated automatically every time the content of a file is modified. So if you create a post, and then a day later notice a typo and correct it, the modification date will change to the time you corrected the typo. The post date will change as well! The modification time may also be changed when a file is copied (This behavior varies from platform to platform and may depend on a number of different factors).

In order to avoid these issues, Indexette preserves the original modification time of the file (which is essentially the creation date of the post), storing this crucial info within the post itself as a tag. The addin changes the behavior of the script so that the index-date tag value is used as the post date, breaking the dependence on the file modification dates.

That tag looks like:

There are three key advantages of this strategy:

  1. The dates are no longer fragile. The a post date will not change unless the site maintainer explicitly changes it.

  2. The post date is more accessible. We can immediately determine the precise date of a post in the same way that we can view the posts content. For example, it is plainly obvious that the date specified by the tag above is May, 7th, 2010 2:36:00 pm

  3. Post dates can be easily modified in the same way you would modify the content of a post. To change the post date simply edit the index-date tag value.

    Continuing with the previous example, if I wanted to set the post date back an hour, that would be:

Indexette is a drag and drop install, with no configuration required (though there are a few optional settings).

As always, feel free to contact me with any questions or comments you might have. You can either post to Ode's forum or send me an email at rob at ode-is-simple dot com.