mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
51 lines
989 B
C++
51 lines
989 B
C++
// index1.cpp
|
|
|
|
#include <ulib/string.h>
|
|
|
|
#undef PACKAGE
|
|
#define PACKAGE "index1"
|
|
#undef ARGS
|
|
#define ARGS ""
|
|
|
|
#define U_OPTIONS \
|
|
"purpose 'index document files to be searched by query...'\n" \
|
|
"option c config 1 'path of configuration file' ''\n"
|
|
|
|
#include "IR.h"
|
|
|
|
class Application : public IR {
|
|
public:
|
|
|
|
void run(int argc, char* argv[], char* env[])
|
|
{
|
|
U_TRACE(5, "Application::run(%d,%p,%p)", argc, argv, env)
|
|
|
|
IR::run(argc, argv, env);
|
|
|
|
if (IR::openCDB(true, true))
|
|
{
|
|
IR::setBadWords();
|
|
|
|
loadFilters();
|
|
|
|
// process all filenames in argument DIRECTORY
|
|
|
|
// operation = 0; // add
|
|
|
|
IR::loadFiles();
|
|
|
|
// save hash table as constant database
|
|
|
|
if (cdb_names->writeTo(UPosting::tbl_name, UPosting::tbl_name_space) &&
|
|
cdb_words->writeTo(UPosting::tbl_words, UPosting::tbl_words_space))
|
|
{
|
|
IR::deleteDB();
|
|
}
|
|
}
|
|
}
|
|
|
|
private:
|
|
};
|
|
|
|
U_MAIN
|