Eli*_*sie 21 indexing search lucene.net full-text-search full-text-indexing
我使用Lucene.Net来索引和搜索文档,我使用以下代码创建或打开索引(如果存在):
IndexWriter writer = new IndexWriter(@"C:\index", new StandardAnalyzer(), !IndexExists);
...
private bool IndexExists
{
get
{
return ??
}
}
Run Code Online (Sandbox Code Playgroud)
现在,如何IndexExists以简单的方式实施?我不需要抛出任何异常.
在<4.0是 IndexReader.indexExists(org.apache.lucene.store.Directory)
在> 4.0是 DirectoryReader.indexExists(org.apache.lucene.store.Directory)