Tag Intersections

This entry was published at least two years ago (originally posted on December 30, 2005). Since that time the information may have become outdated or my beliefs may have changed (in general, assume a more open and liberal current viewpoint). A fuller disclaimer is available.

A little bit more work on improving the tags.app implementation here.

By default, tags.app’s results page from performing a tag search is very sparse — simply a bulleted list of post titles, presented ten at a time. One of the first things I did when tweaking my install was to enhance the page a bit by adding post excerpts, author, and time/datestamps to each entry. I also added a list of ‘related tags’ in the sidebar of the results page.

While tinkering around with adding the tag search field tonight, I realized that it shouldn’t be hard at all for me to add easy tag intersection searches to the tag results page. A few tweaks later, and it’s done: when a search on a tag is performed, the list of related tags now includes a small ‘[+]‘ symbol before each tag. Clicking on the tag itself will start a new search for that tag alone — but clicking on the [+] will add that tag to the search (and narrow down the ‘related tags’ list dramatically). I’ve been playing with this, and it’s making it very easy to drill down through the thousands of entries on the site very quickly.

Code snippets follow.

First: my changes to the “ section:

  <h3>Local tag search for '':</h3>
   items total (Page 
   of )

   <a>" title="Previous"&gt;&laquo; Previous 10 &laquo;
   </a>&nbsp;<a>" 
   title="Next"&gt;&raquo; Next 10 &raquo;</a>

  <ul>

 <li><strong><a>"&gt;</a></strong>: 

  Posted by 
    on  @ 
    </p></li>

  </ul>
  <p>
   <a>" title="Previous"&gt;&laquo; Previous 10 &laquo;
   </a>&nbsp;<a>" 
   title="Next"&gt;&raquo; Next 10 &raquo;</a>


No search performed.
Nothing found.

Next, the ‘related tags’ section I inserted into the sidebar:

<div>
 <h2>Related tags:</h2>
 <div>
  <ul>
   <li><a>mt-tags.cgi?blog_id=&amp;
    tags=+" title="Add '' to 
    the current search"&gt;<strong>[+]</strong></a> <a>mt-tags.cgi?
    blog_id=&amp;tags=" title="Local tag search for ''"&gt;
    </a></li>
  </ul>
 </div>
</div>

Looks complicated, but it was actually all fairly easy to puzzle out.

2 thoughts on “Tag Intersections”

Comments are closed.