private static void build (Dataset dataset, File path)
{
Directory directory = null ;
IndexWriter indexWriter = null ;
IndexBuilderModel larqBuilder = null ;
try {
directory = FSDirectory.open(path) ;
indexWriter = IndexWriterFactory.create(directory);
larqBuilder = new IndexBuilderString(indexWriter) ;
larqBuilder.setAvoidDuplicates(false) ;
index(larqBuilder, dataset.getDefaultModel()) ;
for ( Iterator<String> iter = dataset.listNames() ; iter.hasNext() ; )
{
String g = iter.next() ;
index(larqBuilder, dataset.getNamedModel(g)) ;
}
} catch (Exception e) {
log.warn("Exception building the index: {}", e.getMessage()) ;
} finally {
if ( larqBuilder != null) larqBuilder.closeWriter() ;
if ( directory != null ) try { directory.close() ; } catch (IOException e) { log.warn("Problems closing the Lucene directory.") ; }
}
}