50 likes | 62 Views
Lucene Homework. Search, Corpora Characteristics, & Lucene Introduction. Lucene Intro. Lucene is an open source library that allows indexing and search applications to be built It is not a standalone application The Lucene demos provide starting points. Lucene CLASSPATH variable.
E N D
Lucene Homework Search, Corpora Characteristics, & Lucene Introduction
Lucene Intro • Lucene is an open source library that allows indexing and search applications to be built • It is not a standalone application • The Lucene demos provide starting points
Lucene CLASSPATH variable • If you installed lucene @ c:\, your CLASSPATH variable is: .; C:\lucene-2.4.0\lucene-core-2.4.0.jar;C:\lucene-2.4.0\lucene-demos-2.4.0.jar; watch the periods & hyphens watch the ‘s’
Lucene IndexFiles Demo Changes I made to IndexFiles.java -- //package org.apache.lucene.demo; <- COMMENT THIS OUT import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.demo.FileDocument; <- ADD THIS import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Date;
Changing invoked analyzer Put different analyzers here Date start = new Date(); try { IndexWriter writer = new IndexWriter(INDEX_DIR, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED); System.out.println("Indexing to directory '" +INDEX_DIR+ "'..."); indexDocs(writer, docDir); System.out.println("Optimizing..."); writer.optimize(); writer.close(); Date end = new Date(); System.out.println(end.getTime() - start.getTime() + " total milliseconds"); } catch (IOException e) { System.out.println(" caught a " + e.getClass() + "\n with message: " + e.getMessage()); }();