Status

Proposed

Target Release

4.1

Issue

ROL-1544

Original Authors

Dave Johnson

Abstract

Roller provides a simple search interface in the form of a search URI that returns search results in HTML format and URIs that can return search results in Atom format. By adding support for OpenSearch, we can make it possible for other applications to discover and use Roller's search services in a programmatic fashion.

Requirements

  • Roller must return an OpenSearch descriptor describing Roller's search interface
  • Roller search feeds should contain OpenSearch extension elements with additional metadata

Issues

No real issues to discuss, but here is background to consider:

This development will complement Roller's existing search facilities:

  • SearchServlet. Currently, we have a SearchServlet that displays search results within the
    context of a weblog. If the weblog is a site-wide aggregated weblog, then the
    search results are site-wide. URL is of this format:
    • <ctx>/<weblog-handle>search?q=<search-term>
  • FeedServlet. We also have a FeedServlet that dislays feeds in RSS/Atom formats and search
    feeds in Atom format. The URL is of this format:
    • <ctx>/<weblog-handle>/feed/entries/atom?q=<search-term>
  • Feed History is supported in search feeds via link elements with 'next' and 'previous' relations.

Design

OpenSearchServlet.java

  • Introduces two new URI structures
  • /roller-services/opensearch: returns descriptor for site-wide search (i.e. against main blog)
  • /roller-services/opensearch/<weblog-handle> - returns descriptor for weblog search

FeedServlet.java

  • Minor refactoring to add two templates for search result feeds
  • weblog-search-atom.vm
  • site-search-atom.vm

URLModel.java, URLStrategy.java

  • New methods for returning URI of OpenSearch descriptor

WEB-INF/velocity/weblog.vm

  • Add OpenSearch descriptor links to showAutodiscoveryLinks macro, like so:
        #if ($site)
            <link rel="search"
                title="OpenSearch Descriptor for $config.siteName"
                type="application/opensearchdescription+xml"
                href="$url.absoluteSite/roller-services/opensearch" />
        #else
            <link rel="search"
                title="OpenSearch Descriptor for weblog $model.weblog.name"
                type="application/opensearchdescription+xml"
                href="$url.absoluteSite/roller-services/opensearch/$model.weblog.handle" />
        #end
    

Comments

Please comment on the Roller dev mailing list.

  • No labels