Skip to content
Snippets Groups Projects

indexer add timer

Merged Christine Brovkina requested to merge master into main
4 files
+ 92
2
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 10
1
@@ -34,6 +34,7 @@ public class Indexer {
public static void main(String args[]) {
String usage = "java Indexer";
rebuildIndexes("indexes");
}
public static void insertDoc(IndexWriter i, String item_id, String name, String category, String description){
Document doc = new Document();
@@ -46,6 +47,8 @@ public class Indexer {
}
public static void rebuildIndexes(String indexPath) {
try {
long start = System.currentTimeMillis(); //keep track of the time
Path path = Paths.get(indexPath);
System.out.println("Indexing to directory '" + indexPath + "'...\n");
@@ -58,6 +61,7 @@ public class Indexer {
//--START INDEXING--
IndexWriter i = new IndexWriter(directory, config);
i.deleteAll();
//keep count
//--OPEN DB CONNECTION--
conn = DbManager.getConnection(true);
@@ -86,7 +90,12 @@ public class Indexer {
i.close();
directory.close();
//--END INDEXING--
//--END INDEXING--
long end = System.currentTimeMillis(); //finish timer
System.out.println("Indexing took "
+ (end - start) + " milliseconds");
} catch (Exception e) {
e.printStackTrace();
}
Loading