clucene-core-0.9.21b/src/demo DeleteFiles.cpp分析
2009-04-25 22:27
369 查看
#include "stdafx.h" #include "CLucene.h" #include <iostream> using namespace std; using namespace lucene::index; using namespace lucene::util; using namespace lucene::store; using namespace lucene::document; void DeleteFiles(const char* dir) { IndexReader* reader = IndexReader::open(dir); //打开目录 int32_t count = 0; for (int32_t i = 0; i < reader->maxDoc(); i++){//遍历所有文档,并删除 reader->deleteDocument (i); count ++; } printf("Deleted %d files/n", count);//输出删除的文件数 reader->close(); //关闭,释放 以后这2步要记住 _CLDELETE(reader); //OPTIMIZE //优化 if ( IndexReader::indexExists(dir) ){//检测指定目录是否存在 lucene::analysis::SimpleAnalyzer an; if ( IndexReader::isLocked(dir) ){//解除锁 printf("Index was locked... unlocking it./n"); IndexReader::unlock(dir); } IndexWriter* writer = _CLNEW IndexWriter( dir, &an, false);// //索引重排 writer->optimize(); _CLDELETE(writer); } }
相关文章推荐
- clucene-core-0.9.21b/src/demo main.cpp分析
- clucene-core-0.9.21b/src/demo Statistics.cpp分析
- clucene-core-0.9.21b/src/demo SearchFiles.cpp
- Windows下clucene-core-2.3.3.4的编译方法
- Windows下clucene-core-2.3.3.4的编译方法
- CLucene 'core' package requires no external dependencies 'contrib' package uses a limited number of dependencies
- windows下安装coreseek/sphinx
- ASP.NET Core部署在IIS中后,报无法打开登录所请求的数据库 "xxxx"。登录失败
- iOS CoreText 行间距 bug
- ASP.net core 2.0.0 中 asp.net identity 2.0.0 的基本使用(四)—用户注册
- solr core admin命令
- 把AspDotNetCoreMvc程序运行在Docker上-part2:修改容器以及发布镜像
- DTCoreText项目使用浅析 (1)
- Linux 系统设置 ulimit 以及 Core文件的生成
- JavaScriptCore and iOS 7
- ASP.NET Core 处理 404 Not Found
- Linux/Documentation/cpu-freq/core.txt
- ASP.NET Core 网站发布到Linux服务器
- GDB调试之core文件(如何定位到Segment fault)
- 学习ABP ASP.NET Core with Angular 环境问题