FileDocCategorySizeDatePackage
CreateIndex.javaAPI DocExample2138Wed May 18 09:39:02 BST 2005com.discursive.jccook.xml.bardsearch

CreateIndex

public final class CreateIndex extends Object

Fields Summary
private static Logger
logger
Constructors Summary
private CreateIndex()

Methods Summary
public static voidmain(java.lang.String[] pArgs)

      LogInit.init(); 
        File dataDir = new File("./data/shakespeare");
        logger.info( "Looking for XML files in " + dataDir.getAbsolutePath() );
        FilenameFilter xmlFilter = new GlobFilenameFilter( "*.xml" );
        File[] xmlFiles = dataDir.listFiles( xmlFilter );
        
        logger.info( "Creating Index");
        IndexWriter writer = new IndexWriter("index", new StandardAnalyzer(), true);
        PlayIndexer playIndexer = new PlayIndexer( writer );
        playIndexer.init();
        for (int i = 0; i < xmlFiles.length; i++) {
            System.out.println( "Indexing: " + xmlFiles[i] );
            playIndexer.index(xmlFiles[i]);
        }
        writer.optimize();
        writer.close();
        logger.info( "Parsing Complete, Index Created");