Reputation: 113
Is there any way to check Lucene index size in the Lucene API? I mean other than going to FSDirectory.getDirectory and "manually" checking file size for every file in the directory? Thanks!
Maxim
Upvotes: 2
Views: 980
Reputation: 20693
AFAIK there is no method to get index size, but instead of getting all files in directory you should grab file list with IndexReader :
IndexReader ir = IndexReader.Open(FDirectory);
foreach(string fName in ir.Directory().List())
{
// sum file sizes here
}
ir.Close();
Upvotes: 2
Reputation: 113
Well, I used var size = (from strFile in dir.ListAll() select dir.FileLength(strFile)).Sum();
where dir is Lucene.Net.Store.Directory where the index was created.. Seems good enough..
Maxim
Upvotes: 0