There is a Apache Forrest based Apache Solr client plugin in the forrest whiteboard (our testing ground in forrest). It may be from interest for the ones using Apache Cocoon based Apache Forrest and Apache Lucene based Apache Solr.

org.apache.forrest.plugin.output.solr generates Apache Solr documents from Apache Forrest xdos. Further when run with the Apache Forrest Dispatcher it provides a GUI to manage your project in solr and a search interface to search your solr server.

The documentation and a couple of screenshots can be found at http://forrest.apache.org/pluginDocs/plugins_0_80/org.apache.forrest.plugin.output.solr/

The source code can be found at http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/

You should have a closer look on http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/output.xmap?view=markup and http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/input.xmap?view=markup

We added a solar query generator:

<map:generator name="solr-search" logger="sitemap.generator.searchgenerator" src="org.apache.forrest.solr.client.SolrSearchGenerator" />

and as well a paginator transformer that calculates the next pages based on start, rows and numFound:

<map:transformer logger="sitemap.transformer.solr" name="solr" pool-max="16" src="org.apache.forrest.solr.client.SolrQueryTransformer" />

To use the plugin in your custom project please do the following

  1. svn co http://svn.apache.org/repos/asf/forrest/trunk forrest (this checkout is our $FORREST_HOME)

  2. cd $FORREST_HOME/main; ./build.sh
  3. cd $FORREST_HOME/whiteboard/plugins/org.apache.forrest.plugin.output.solr
  4. $FORREST_HOME/tools/ant/bin/ant local-deploy
  5. cp $FORREST_HOME/whiteboard/plugins/org.apache.forrest.plugin.output.solr/build/org.apache.forrest.plugin.output.solr.jar $cocoon_webapp/WEB-INF/lib/

We use it as follows:

{{{<!-- Will dispatch a query against the solr server --> <map:match pattern="solr-search.xml">

<!-- You would replace this with your own. In forrest we have a property system for that <property name="solr.select.url" value="http://localhost:8983/solr/select"/> -->

<!-- here we add the pagination to the sax from the generator will result in something like: ... <result name="response" numFound="17" start="0">

<doc> ...-->

<!-- here we transform the solr response into xdocs (forrest internal format) the pagination: <xsl:template match="paginator">

</xsl:template> -->

</map:match>}}}

You may be interested in the update generator as well.

Please give feedback to dev@forrest.apache.org.

{{{<map:generator name="solrUpdate" src="org.apache.forrest.solr.client.SolrUpdateGenerator"/>

<!-- Update generator will send the command to the solr server and generate the server response. See the plugin documentation for more details. --> <map:match pattern="**.do">

</map:match>}}}

SolrForrest (last edited 2010-01-25 22:01:43 by TriciaWilliams)