#include
#include "CLucene.h"
#include "CLucene/util/dirent.h"
#include "CLucene/util/CLStreams.h"
using namespace std;
using namespace lucene::analysis;
using namespace lucene::analysis::standard;
using namespace lucene::document;
using namespace lucene::index;
using namespace lucene::queryParser;
using namespace lucene::search;
using namespace lucene::store;
using namespace lucene::util;
int main()
{
FileReader *file = _CLNEW FileReader("/root/tmp/cppwork/air.txt", "ASCII");
Field *field = _CLNEW Field(_T("content"), file, Field::INDEX_TOKENIZED);
Document doc;
doc.add(*field);
StandardAnalyzer an;
IndexWriter writer("/root/tmp/cppwork/index", &an, true);
writer.addDocument(&doc);
writer.close();
_lucene_shutdown();
cout << "hello world" << endl;
return 0;
}
阅读(833) | 评论(2) | 转发(0) |