PLOS
Plone OpenSearch
Plone Open Search is a product for plone 2.1+ and can be downloaded at plone.org. If you still run Plone 2.0 it can be easily integrated in your Plone 2.0 Website by simply adding these two page templates into your custom folder:
plos-description.xml:
plos-rss.xml:
By comparing this templates to the templates you find in the product you will be able to backport other features too.
plos-description.xml:
<?xml version="1.0"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<metal:block tal:define="dummy python:request.RESPONSE.setHeader('Content-Type', 'text/xml;;charset='+context.plone_utils.getSiteEncoding())" />
<ShortName tal:content="here/title">nan Search</ShortName>
<Description tal:content="here/description">Search nan.objectis.net.</Description>
<Url type="application/rss+xml"
indexOffset="0"
template="http://example.com/?q={searchTerms}&pw={startPage?}&format=rss"
tal:attributes="template string:${here/portal_url}/plos-rss.xml?SearchableText={searchTerms}&b_start={startIndex?}" />
<Url type="application/xhtml+xml"
indexOffset="0"
tal:attributes="template string:${here/portal_url}/search?SearchableText={searchTerms}&b_start={startIndex?}" />
</OpenSearchDescription>
plos-rss.xml:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:relevance="http://a9.com/-/opensearch/extensions/relevance/1.0/"
xmlns:atom="http://www.w3.org/2005/Atom">
<metal:block tal:define="dummy python:request.RESPONSE.setHeader('Content-Type', 'text/xml;;charset='+context.plone_utils.getSiteEncoding())" />
<channel tal:define="start python: int(request.get('b_start', 0));
max_items python:int(request.get('count', 20));
startnumber python: start+1;
end python: int(request.get('b_end', start+max_items));
objectList python:context.queryCatalog()[start:end];
endnumber python: start+len(objectList);
searchterm request/SearchableText|nothing;">
<title tal:content="string:${here/title}: $searchterm">Example.com Search: New York history</title>
<link tal:content="string:${here/portal_url}/${template/getId}?SearchableText=$searchterm">http://example.com/plos-rss.xml?SearchableText=New+York+history</link>
<description i18n:translate="batch_x_items_matching_your_criteria">
<span i18n:name="number" tal:omit-tag="" tal:content="python:len(objectList)">234</span> items matching your criteria.
</description>
<opensearch:totalResults tal:content="python:len(objectList)|0">4230000</opensearch:totalResults>
<opensearch:startIndex tal:content="startnumber">21</opensearch:startIndex>
<opensearch:itemsPerPage tal:content="python: end - start">10</opensearch:itemsPerPage>
<atom:link rel="search" type="application/opensearchdescription+xml" href="http://example.com/opensearchdescription.xml"
tal:attributes="href string:${here/portal_url}/plos-description.xml"/>
<opensearch:Query role="request" searchTerms="New York History" startIndex="1"
tal:attributes="searchTerms searchterm; startIndex startnumber"/>
<item tal:repeat="object objectList">
<title tal:content="object/Title">New York History</title>
<link tal:content="object/getURL">http://www.columbia.edu/cu/lweb/eguids/amerihist/nyc.html</link>
<description tal:content="object/Description">
... Harlem.NYC - A virtual tour and information on
businesses ... with historic photos of Columbia's own New York
neighborhood ... Internet Resources for the City's History. ...
</description>
<relevance:score tal:condition="object/data_record_normalized_score_"
tal:content="python:float(object.data_record_normalized_score_)/100">0.95</relevance:score>
</item>
</channel>
</rss>
By comparing this templates to the templates you find in the product you will be able to backport other features too.
