Evolutions brought by Lutece V5

Version 5.0.0

Using the CSS Bootstrap 3 framework for the Front Office

Starting with Lutece v5.0, the front Office templates are based on version 3 of the Bootstrap framework. Check the official documentation describing the migration from version 2.x to 3.0

Upgrade of Lucene libraries

Update of the indexing and analysis library (Lucène and Tika). Lucène is now in version 4.6.1 and Tika in version 1.5. This evolution impacts strongly all plugins using indexing (e.g. directory, form, calendar, ...). Here are the important aspects to consider for the migration :

  • The Searcher class has been removed and replaced by IndexSearcher. The building method is now the following:
IndexReader ir = DirectoryReader.open( %INDEX_PATH% );
searcher =
new IndexSearcher( ir );
  • The HTMLParser class provided by lucene-demos has been replaced by the HtmlParser class provided by Tika. The parsing of HTML documents is now done as follows:

String strContentToIndex = getContentToIndex( document );
ContentHandler handler = new BodyContentHandler( );
Metadata metadata = new Metadata( );
try
{
    
new HtmlParser( ).parse( new ByteArrayInputStream( strContentToIndex.getBytes( ) ), handler, metadata, new ParseContext( ) );
}

catch ( SAXException e )
{
    
throw new AppException( "Error during page parsing." );
}

catch ( TikaException e )
{
    throw new
AppException( "Error during page parsing." );
}

//the content of the article is recovered in the parser because this one
//had replaced the encoded caracters (as é) by the corresponding special caracter (as ?)

StringBuilder sb = new StringBuilder( handler.toString( ) );

  • The Field classes that allow indexing and parsing Lucene fields have been refactored. Here are the changes:
Field.Store.NO, Field.Index.ANALYZED TextField.TYPE_NOT_STORED
Field.Store.YES, Field.Index.ANALYZED TextField.TYPE_STORED
Field.Store.YES, Field.Index.NOT_ANALYZED

FieldType ft = new FieldType( StringField.TYPE_STORED );

ft.setOmitNorms( false );

Field.Store.YES, Field.Index.NO

FieldType ftNo = new FieldType( StringField.TYPE_STORED );

ftNo.setIndexed( false );

ftNo.setTokenized( false );

ftNo.setOmitNorms( false );

Field.Store.NO, Field.Index.NOT_ANALYZED

FieldType ftNotStored = new FieldType( StringField.TYPE_NOT_STORED );

ftNotStored.setOmitNorms( false );

ftNotStored.setTokenized( false );

Field.Store.NO, Field.Index.ANALYZED

FieldType ftNotStored = new FieldType( StringField.TYPE_NOT_STORED );

ftNotStored.setOmitNorms( false );

 

i18n labels with parameters

It is possible from Lutece v5 onwards to pass parameters to a i18n label using the pattern of the Java MessageFormat class in the resource file myplugin_messages.properties :

mykey.message=My message using 2 arguments : {0} and {1}

${i18n( "myplugin.mykey.message" , argument1 , argument2 )}

Overriding i18n values

The default values of the i18n keys can be overridden in files placed under /WEB-INF/conf/override/ and respecting the same directory tree.