|
a/src/query/recollq.cpp |
|
b/src/query/recollq.cpp |
|
... |
|
... |
73 |
|
73 |
|
74 |
static char *thisprog;
|
74 |
static char *thisprog;
|
75 |
static char usage [] =
|
75 |
static char usage [] =
|
76 |
" [-o|-a|-f] <query string>\n"
|
76 |
" [-o|-a|-f] <query string>\n"
|
77 |
" Runs a recoll query and displays result lines. \n"
|
77 |
" Runs a recoll query and displays result lines. \n"
|
78 |
" Default: will interpret the argument(s) as a wasabi query string\n"
|
78 |
" Default: will interpret the argument(s) as a xesam query string\n"
|
79 |
" query may be like: \n"
|
79 |
" query may be like: \n"
|
80 |
" implicit AND, Exclusion, field spec: t1 -t2 title:t3\n"
|
80 |
" implicit AND, Exclusion, field spec: t1 -t2 title:t3\n"
|
81 |
" OR has priority: t1 OR t2 t3 OR t4 means (t1 OR t2) AND (t3 OR t4)\n"
|
81 |
" OR has priority: t1 OR t2 t3 OR t4 means (t1 OR t2) AND (t3 OR t4)\n"
|
82 |
" Phrase: \"t1 t2\" (needs additional quoting on cmd line)\n"
|
82 |
" Phrase: \"t1 t2\" (needs additional quoting on cmd line)\n"
|
83 |
" -o Emulate the gui simple search in ANY TERM mode\n"
|
83 |
" -o Emulate the gui simple search in ANY TERM mode\n"
|
|
... |
|
... |
113 |
#define OPT_q 0x200
|
113 |
#define OPT_q 0x200
|
114 |
#define OPT_t 0x400
|
114 |
#define OPT_t 0x400
|
115 |
#define OPT_m 0x800
|
115 |
#define OPT_m 0x800
|
116 |
#define OPT_D 0x1000
|
116 |
#define OPT_D 0x1000
|
117 |
#define OPT_S 0x2000
|
117 |
#define OPT_S 0x2000
|
118 |
|
118 |
#define OPT_s 0x4000
|
119 |
|
119 |
|
120 |
int recollq(RclConfig **cfp, int argc, char **argv)
|
120 |
int recollq(RclConfig **cfp, int argc, char **argv)
|
121 |
{
|
121 |
{
|
122 |
string a_config;
|
122 |
string a_config;
|
123 |
string sortfield;
|
123 |
string sortfield;
|
|
|
124 |
string stemlang("english");
|
124 |
|
125 |
|
125 |
int limit = 2000;
|
126 |
int limit = 2000;
|
126 |
thisprog = argv[0];
|
127 |
thisprog = argv[0];
|
127 |
argc--; argv++;
|
128 |
argc--; argv++;
|
128 |
|
129 |
|
|
... |
|
... |
150 |
case 'o': op_flags |= OPT_o; break;
|
151 |
case 'o': op_flags |= OPT_o; break;
|
151 |
case 'q': op_flags |= OPT_q; break;
|
152 |
case 'q': op_flags |= OPT_q; break;
|
152 |
case 'S': op_flags |= OPT_S; if (argc < 2) Usage();
|
153 |
case 'S': op_flags |= OPT_S; if (argc < 2) Usage();
|
153 |
sortfield = *(++argv);
|
154 |
sortfield = *(++argv);
|
154 |
argc--; goto b1;
|
155 |
argc--; goto b1;
|
|
|
156 |
case 's': op_flags |= OPT_s; if (argc < 2) Usage();
|
|
|
157 |
stemlang = *(++argv);
|
|
|
158 |
argc--; goto b1;
|
155 |
case 't': op_flags |= OPT_t; break;
|
159 |
case 't': op_flags |= OPT_t; break;
|
156 |
default: Usage(); break;
|
160 |
default: Usage(); break;
|
157 |
}
|
161 |
}
|
158 |
b1: argc--; argv++;
|
162 |
b1: argc--; argv++;
|
159 |
}
|
163 |
}
|
|
... |
|
... |
222 |
|
226 |
|
223 |
if (!sd) {
|
227 |
if (!sd) {
|
224 |
cerr << "Query string interpretation failed: " << reason << endl;
|
228 |
cerr << "Query string interpretation failed: " << reason << endl;
|
225 |
return 1;
|
229 |
return 1;
|
226 |
}
|
230 |
}
|
227 |
sd->setStemlang("english");
|
231 |
sd->setStemlang(stemlang);
|
228 |
|
232 |
|
229 |
RefCntr<Rcl::SearchData> rq(sd);
|
233 |
RefCntr<Rcl::SearchData> rq(sd);
|
230 |
Rcl::Query query(&rcldb);
|
234 |
Rcl::Query query(&rcldb);
|
231 |
if (op_flags & OPT_S) {
|
235 |
if (op_flags & OPT_S) {
|
232 |
query.setSortBy(sortfield, (op_flags & OPT_D) ? false : true);
|
236 |
query.setSortBy(sortfield, (op_flags & OPT_D) ? false : true);
|