add option -s to select stemming language

This commit is contained in:
dockes 2009-12-08 07:43:07 +00:00
parent dcd17f4436
commit 54ec944e41

View File

@ -75,7 +75,7 @@ static char *thisprog;
static char usage [] = static char usage [] =
" [-o|-a|-f] <query string>\n" " [-o|-a|-f] <query string>\n"
" Runs a recoll query and displays result lines. \n" " Runs a recoll query and displays result lines. \n"
" Default: will interpret the argument(s) as a wasabi query string\n" " Default: will interpret the argument(s) as a xesam query string\n"
" query may be like: \n" " query may be like: \n"
" implicit AND, Exclusion, field spec: t1 -t2 title:t3\n" " implicit AND, Exclusion, field spec: t1 -t2 title:t3\n"
" OR has priority: t1 OR t2 t3 OR t4 means (t1 OR t2) AND (t3 OR t4)\n" " OR has priority: t1 OR t2 t3 OR t4 means (t1 OR t2) AND (t3 OR t4)\n"
@ -115,12 +115,13 @@ static int op_flags;
#define OPT_m 0x800 #define OPT_m 0x800
#define OPT_D 0x1000 #define OPT_D 0x1000
#define OPT_S 0x2000 #define OPT_S 0x2000
#define OPT_s 0x4000
int recollq(RclConfig **cfp, int argc, char **argv) int recollq(RclConfig **cfp, int argc, char **argv)
{ {
string a_config; string a_config;
string sortfield; string sortfield;
string stemlang("english");
int limit = 2000; int limit = 2000;
thisprog = argv[0]; thisprog = argv[0];
@ -152,6 +153,9 @@ int recollq(RclConfig **cfp, int argc, char **argv)
case 'S': op_flags |= OPT_S; if (argc < 2) Usage(); case 'S': op_flags |= OPT_S; if (argc < 2) Usage();
sortfield = *(++argv); sortfield = *(++argv);
argc--; goto b1; argc--; goto b1;
case 's': op_flags |= OPT_s; if (argc < 2) Usage();
stemlang = *(++argv);
argc--; goto b1;
case 't': op_flags |= OPT_t; break; case 't': op_flags |= OPT_t; break;
default: Usage(); break; default: Usage(); break;
} }
@ -224,7 +228,7 @@ int recollq(RclConfig **cfp, int argc, char **argv)
cerr << "Query string interpretation failed: " << reason << endl; cerr << "Query string interpretation failed: " << reason << endl;
return 1; return 1;
} }
sd->setStemlang("english"); sd->setStemlang(stemlang);
RefCntr<Rcl::SearchData> rq(sd); RefCntr<Rcl::SearchData> rq(sd);
Rcl::Query query(&rcldb); Rcl::Query query(&rcldb);