Tuesday, 19 April 2011

Magnolia Apache Solr integration

Last week I finally released the magnolia-solr-module on Magnolia's Forge. The module aims at bringing Apache Solr outstanding search features into Magnolia. For those who don't know Solr:

"Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project. Its major features include powerful full-text search, hit highlighting, faceted search, dynamic clustering, database integration, rich document (e.g., Word, PDF) handling, and geospatial search. Solr is highly scalable, providing distributed search and index replication, and it powers the search and navigation features of many of the world's largest internet sites."

Solr is used by some of the largest companies in the world such as apple, ebay, zappos, gettyimages and salesforce, to name just a few. Recently The Guardian (which has the second highest readership of any on-line news site after the New York Times) has chosen Solr for its content API.

The reason for integrating Magnolia and Solr is a very simple one: have the best open source tool for a given task do the job. In my case, I like to manage and publish contents with Magnolia CMS (of course, I am biased towards Magnolia ;)) and its easy to use, intuitive interface, and then index and search those contents with Solr.

In the step-by-step tutorial accompanying the module I explain how to achieve this. There I also explain how to customize the module in case its default behavior does not suit your needs.

So, if you need blazing fast search for your Magnolia-based website, give the module a go and enjoy Magnolia+Solr integration!

Tuesday, 23 February 2010

Magnolia Groovy module 1.0-m2 video

The Magnolia Groovy module 1.0 Milestone 2 has just been released. Briefly, what it does is adding first-class Groovy support into Magnolia's CMS at a deeper, system-wide level, allowing for managing Groovy classes and scripts directly within Magnolia's AdminCentral. The really innovative feature is the ability to plug in at runtime (almost) whatever piece of the CMS with a Groovy counterpart - no need for deployments and stopping/starting the servlet container. Of course, some common sense is highly recommended here and, though in theory possible, I would not endorse to rewrite and replace everything with Groovy, especially classes performing time-critical tasks. At least, not until Groovy will have become as fast as, if not faster than, Java ;-), which the guys working at Groovy++ seem trying to achieve. The video here will show this and other new features, such as easy hierarchy JCR navigation through nodes and attributes simply by using . (dot) notation (something similar to what Groovy does with XML with its XmlSlurper).

Wednesday, 2 July 2008

Subversion client too old

This is a workaround to fix a problem I had with my svn client after upgrading to Eclipse Ganymede and Subclipse plugin last week. It is based on scattered information I found on the web and that I managed to put together. Hopefully it will save someone some time (somewhere... something... somehow...).
Basically, I had ended up with an svn client 1.4 on my system (ubuntu 8.04) whereas subclipse used a somehow bundled latest version 1.5. So everything went fine, as long as I did my svn work from within eclipse. Until one day (today) I had to do an
svn up
from the shell (we use maven modules and this time I had to update from the parent pom location). Then I got this message
This client is too old to work with working copy '.'; 
please get a newer Subversion client.
This was baffling, as
apt-get install subversion
told me that I had the latest package installed. After some googling, it turned out that svn 1.5 upgrades your working (local) files in a way that it's incompatible with svn client 1.4. To cut it short, I decided to upgrade my svn client.

Here are the steps to follow:

  • At the moment, subversion 1.5 deb package is still considered experimental, so you'll need to add a line to your
    /etc/apt/sources.list
    like this:
    deb http://ftp.it.debian.org/debian experimental main
    (You can choose a different mirror here http://packages.debian.org/experimental/i386/subversion/download)

  • Then do
    apt-get update
    to update your deb repositories

  • Finally
    apt-get install subversion
    to update your svn client to version 1.5. I gladly ignored the warnings about some non authenticable packages (those coming from the experimental repository).

Now everything is working fine.

Saturday, 10 May 2008

Tutorial: how to export an MBean in Grails

This is a cookbook tutorial I wrote while working-playing-learning (I guess I'm lucky that I am doing for a living something where these three things often get along) with Grails.
It shows how to export Hibernate's StatisticsService MBean by leveraging Spring's JMX support through Grails's BeanBuilder, a class that uses dynamic Groovy to construct bean definitions.

http://docs.codehaus.org/display/GRAILS/MBean+export+the+Groovy+way

Sunday, 20 April 2008

Flickr horizontal menu with Prototype

Last week, while looking for a drop-down menu for a Grails application, I came across this one which is very nice but uses jQuery. As Grails comes with Prototype as the default javascript framework and I didn't want to add another dependency, nor mess up with jQuery and Prototype incompatibilities, I decided to port it to Prototype. To set up the menu and download the images and the css, please refer to the original menu post, then substitute the jQuery code with the Prototype one below.

/*
* Flickr-like menu ported from jQuery to Prototype.
* The original is at http://www.candesprojects.com/downloads/flickr-horizontal-menu/
*
* @requires prototype 1.6
*
*/
document.observe("dom:loaded", function() {

$$("#nicemenu img.arrow").invoke("observe", "click", function(e){
headMenu = e.findElement('span.head_menu');
//div.sub_menu
submenu = e.findElement('li').down(3);

if(submenu.getStyle('display')=='block'){
headMenu.removeClassName("active");
submenu.hide();
this.writeAttribute('src','arrow_hover.png');
} else {
headMenu.addClassName("active");
submenu.setStyle({'display': 'block'});
this.writeAttribute('src','arrow_select.png');
}

$$("div.sub_menu:visible").each(function(e){
if(e!=submenu){
e.setStyle({'display': 'none'});
}
});

$$("#nicemenu img.arrow").each(function(e) {
if(e != this){
e.writeAttribute('src','arrow.png');
}
});


$$("#nicemenu span.head_menu").each(function(e) {
if(e != headMenu){
e.removeClassName('active');
}
});

});

$$("#nicemenu img.arrow").invoke("observe", "mouseover", function(e){
this.writeAttribute('src','arrow_hover.png');
});

$$("#nicemenu img.arrow").invoke("observe", "mouseout", function(e){
submenu = e.findElement('li').down(3);
if(submenu.getStyle('display')!='block'){
this.writeAttribute('src','arrow.png');
} else {
this.writeAttribute('src','arrow_select.png');
}
});

$$("#nicemenu span.head_menu").invoke("observe", "mouseover", function(){
this.addClassName('over');
});

$$("#nicemenu span.head_menu").invoke("observe", "mouseout", function(){
this.removeClassName('over');
});

document.observe("click", function(e) {
var elt = e.findElement('#nicemenu');
if (elt == undefined){
$$("#nicemenu span.head_menu").invoke('removeClassName','active');
$$("#nicemenu div.sub_menu").invoke('hide');
$$("#nicemenu img.arrow").invoke('writeAttribute','src','arrow.png');
}});

});