Created
December 4, 2017 16:50
-
-
Save ismailmayat/f47ed214b654bb21b23ecd2218a67bd4 to your computer and use it in GitHub Desktop.
Code to get all docs in lucene when using examine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int MaxDocs() | |
{ | |
BaseSearchProvider searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"]; | |
var baseSeacher = (LuceneSearcher) _searcher; | |
var folder = baseSeacher.LuceneIndexFolder; | |
var fsDir = FSDirectory.Open(folder); | |
var reader = IndexReader.Open(fsDir, true); | |
int maxDocCount = reader.NumDocs(); | |
reader.Dispose(); | |
fsDir.Dispose(); | |
return maxDocCount; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment