I was lucky today, I created simple 'flowscript' for Cocoon 2.1.9, and it
works fine...
We should probably separate business-related end-user errors (such as when
user submits empty query) and make it XML-like (instead of HTTP 400)
I want to play a little with 'Faceted Browsing' and Cocoon.
Thanks,
here are basic files for Cocoon:
query.js
=====
function main() {
var query = cocoon.request.get("query");
if (query == null || query == "") {
cocoon.sendPage("query");
} else {
cocoon.sendPage("aggregate", {"query" : query} );
}
}
query.jx
=====
<?xml version="1.0"?>
<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
<title>Query JX</title>
<content>
<form method="get" action="">
<input type="text" name="query" value="${query}" />
<input type="submit" value="Search"/>
</form>
</content>
</page>
sitemap.xmap
========
<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:flow language="javascript">
<map:script src="query.js"/>
</map:flow>
<map:pipelines>
<map:pipeline>
<map:match pattern="">
<map:call function="main"/>
</map:match>
<map:match pattern="query">
<map:generate type="jx" src="query.jx"/>
<map:serialize type="xhtml"/>
</map:match>
<map:match pattern="response">
<map:generate
src="http://localhost:8983/solr/select/?q={request-param:query}"/>
<map:transform src="context://samples/solr/example.xsl" />
<map:serialize type="html"/>
</map:match>
<map:match pattern="aggregate">
<map:aggregate element="page">
<map:part src="cocoon:/query" element="query"/>
<map:part src="cocoon:/response" element="response"/>
</map:aggregate>
<map:transform
src="context://samples/common/style/xsl/html/simple-page2html.xsl" />
<map:serialize/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
context://samples/solr/example.xsl - copied from SOLR distribution
--
View this message in context:
http://www.nabble.com/Cocoon-2.1.9-vs.-SOLR-20---SOLR-30-tf2639621.html#a7412487
Sent from the Solr - Dev mailing list archive at Nabble.com.