Data includes:
this.config = config; // analyzer (default is standard analyzer) analyzer = (Analyzer) Class.forName(config.get("analyzer", "org.apache.lucene.analysis.standard.StandardAnalyzer")).newInstance(); // doc maker docMaker = (DocMaker) Class.forName(config.get("doc.maker", "org.apache.lucene.benchmark.byTask.feeds.SimpleDocMaker")).newInstance(); docMaker.setConfig(config); // query makers readTaskQueryMaker = new HashMap(); qmkrClass = Class.forName(config.get("query.maker","org.apache.lucene.benchmark.byTask.feeds.SimpleQueryMaker")); // html parser, used for some doc makers htmlParser = (HTMLParser) Class.forName(config.get("html.parser","org.apache.lucene.benchmark.byTask.feeds.DemoHTMLParser")).newInstance(); docMaker.setHTMLParser(htmlParser); // index stuff reinit(false); // statistic points points = new Points(config); if (Boolean.valueOf(config.get("log.queries","false")).booleanValue()) { System.out.println("------------> queries:"); System.out.println(getQueryMaker(new SearchTask(this)).printQueries()); }
returnReturns the anlyzer. return analyzer;
return analyzer;
returnReturns the config. return config;
return config;
returnReturns the directory. return directory;
return directory;
returnReturns the docMaker. return docMaker;
return docMaker;
returnReturns the htmlParser. return htmlParser;
return htmlParser;
returnReturns the indexReader. return indexReader;
return indexReader;
returnReturns the indexWriter. return indexWriter;
return indexWriter;
returnReturns the points. return points;
return points;
returnReturns the queryMaker by read task type (class) // mapping the query maker by task class allows extending/adding new search/read tasks // without needing to modify this class. Class readTaskClass = readTask.getClass(); QueryMaker qm = (QueryMaker) readTaskQueryMaker.get(readTaskClass); if (qm == null) { try { qm = (QueryMaker) qmkrClass.newInstance(); qm.setConfig(config); } catch (Exception e) { throw new RuntimeException(e); } readTaskQueryMaker.put(readTaskClass,qm); } return qm;
// mapping the query maker by task class allows extending/adding new search/read tasks // without needing to modify this class. Class readTaskClass = readTask.getClass(); QueryMaker qm = (QueryMaker) readTaskQueryMaker.get(readTaskClass); if (qm == null) { try { qm = (QueryMaker) qmkrClass.newInstance(); qm.setConfig(config); } catch (Exception e) { throw new RuntimeException(e); } readTaskQueryMaker.put(readTaskClass,qm); } return qm;
// cleanup index if (indexWriter!=null) { indexWriter.close(); indexWriter = null; } if (indexReader!=null) { indexReader.close(); indexReader = null; } if (directory!=null) { directory.close(); } // directory (default is ram-dir). if ("FSDirectory".equals(config.get("directory","RAMDirectory"))) { File workDir = new File("work"); File indexDir = new File(workDir,"index"); if (eraseIndex && indexDir.exists()) { FileUtils.fullyDelete(indexDir); } indexDir.mkdirs(); directory = FSDirectory.getDirectory(indexDir); } else { directory = new RAMDirectory(); } // inputs resetInputs(); // release unused stuff System.runFinalization(); System.gc();
docMaker.resetInputs(); Iterator it = readTaskQueryMaker.values().iterator(); while (it.hasNext()) { ((QueryMaker) it.next()).resetInputs(); }
paramdirectory The directory to set. this.directory = directory;
this.directory = directory;
paramindexReader The indexReader to set. this.indexReader = indexReader;
this.indexReader = indexReader;
paramindexWriter The indexWriter to set. this.indexWriter = indexWriter;
this.indexWriter = indexWriter;