Indexing reports are created for indexing and updating operations. Indexing reports can be retrieved from the index using the getIndexingReports method. Reports are stored in the index only while the index is loaded into RAM for use. If you reload the index, the reports will not be restored.
Each index report contains the following information:
The total number of documents in the index;
The total number of words in the index;
The total length of indexed documents in MB;
Number of index segments;
The total size of the index on disk in bytes;
The indexing start time;
The indexing end time;
The indexing duration;
List of errors;
List of indexed documents;
List of updated documents;
List of removed documents.
The following example demonstrates how to get indexing reports from an index.
StringindexFolder="c:\\MyIndex\\";StringdocumentsFolder1="c:\\MyDocuments1\\";StringdocumentsFolder2="c:\\MyDocuments2\\";// Creating an index in the specified folder
Indexindex=newIndex(indexFolder);// Indexing documents
index.add(documentsFolder1);index.add(documentsFolder2);// Getting indexing reports
IndexingReport[]reports=index.getIndexingReports();// Printing information from reports to the console
for(IndexingReportreport:reports){System.out.println("Time: "+report.getStartTime());System.out.println("Duration: "+report.getIndexingTime());System.out.println("Documents total: "+report.getTotalDocumentsInIndex());System.out.println("Terms total: "+report.getTotalTermCount());System.out.println("Indexed documents size (MB): "+report.getIndexedDocumentsSize());System.out.println("Index size (MB): "+(report.getTotalIndexSize()/1024.0/1024.0));System.out.println();}
More resources
GitHub examples
You may easily run the code from documentation articles and see the features in action in our GitHub examples: