[opencms-dev] OpenCms-SVNLucene has been released

Shi Yusen shiys at langhua.cn
Tue Jul 7 18:59:53 CEST 2009


Hi list,

I'm glad to announce a new OpenCms-SVNLucene has been released. As its
name says, this is module can help you to build lucene index for your
svn and search it.

This module is developed on Fedora 10, Apache 2.2.11, Perl 5.10.0, SVN
1.5.4, MySQL 5.0.77,
OpenCms 7.0.5, OpenJDK 1.6.0.

This module is in LGPL v3.0 licence (I'm not sure whether I should use
Perl licence for
the perl module part, I havn't touch Perl for 8 years).

Unlike other opensource svn search engine, this module is much easier
for OpenCms developers to
write an svn search page.

This module contains two parts: an Apache perl module and an OpenCms
module.

The Apache Perl module is Apache2::FilterSVNActions. This perl module
can filter the SVN actions
and send request to OpenCms SVNLucene module to add or delete index of
SVN file.


1. Procedures to build Lucene index:
1.1 Normal Routine:
Usually this happens when use an SVN client to import files or delete
files.

1.2 Rebuild Routine:
Usually this happens when run "svn export http://svnserver/svn/".


2. Installation of Perl module:
2.1 Sample configuration of perl.conf:
LoadModule perl_module modules/mod_perl.so
PerlRequire /var/www/perl/startup.pl


2.2 Sample configuration of Virtualhost:
<VirtualHost *:80>
    ......
    PerlModule Apache2::FilterSVNActions
    ......
</VirtualHost>


2.3 Sample of startup.pl
#!/usr/bin/perl
use lib qw(/var/www/perl);

# use Apache2::Status ();
use Apache::DBI ();
# $Apache::DBI::DEBUG = 2;

Apache::DBI->connect_on_init("dbi:mysql:svnlucene:localhost:3306",
   "root",
   "111111",
   {
    PrintError => 1, # warn() on errors
    RaiseError => 0, # don't die on error
    AutoCommit => 1, # commit executes immediately
   }
);

1;

2.4 Sample configuration of SVN directory:
<Location /opensource>
   DAV svn
   SVNPath /usr/local/svn/opensource/

   PerlInputFilterHandler   Apache2::FilterSVNActions::request
   PerlOutputFilterHandler  Apache2::FilterSVNActions::request
   PerlOptions +GlobalRequest

   ......
</Location>


3. Create MySQL database:
CREATE TABLE `RESOURCES` (
  `ID` bigint(20) unsigned NOT NULL auto_increment,
  `URI` varchar(255) NOT NULL,
  `ACTION` enum('PUT','DELETE','REPORT') NOT NULL,
  `UUID` varchar(36) NOT NULL,
  PRIMARY KEY  (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
Please note: the MySQL database name and table name are hardcoded in
FilterSVNActions.pm.


4. Installation of OpenCms module:
4.1 Import org.langhua.opencms.svnlucene_1.0.5.x.zip by OpenCms Module
Management tool

4.2 Create an SVN Lucene index by OpenCms Search Management tool.
By default, please use "svnlucene" as the index name. Currently this is
hardcoded in CmsSVNLucene.java.

4.3 Restart OpenCms.


5. Test:
5.1 Build the svnlucene index:
Run "svn export http://svnserver/svn/", the svnlucene index will be
created automatically under 
${opencms}/WEB-INF/index/svnlucene/.

5.2 Search:
In OpenCms Search Management tool, search the svnlucene index and you
should be able to get what you want.


6. Source Code:
You can get the source code from
http://langhua.org/opensource/opencms/svnlucene/


7. References:
7.1 Apache2 mod_perl filter:
http://perl.apache.org/docs/2.0/user/handlers/filters.html

7.2 SVN protocal:
http://svn.collab.net/repos/svn/trunk/www/webdav-usage.html


8. What will be new in next version?
In next version, we'll try to build the index docs with version info.


If you find any bugs in this module, please do feedback to me:
shiys at langhua.cn.

Enjoy it,

Shi Yusen/Beijing Langhua Ltd.





More information about the opencms-dev mailing list