Changeset 397 for trunk/gsdl/src/recpt/queryaction.cpp
- Timestamp:
- 1999-07-16T12:19:02+12:00 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/queryaction.cpp
r356 r397 12 12 /* 13 13 $Log$ 14 Revision 1.13 1999/07/16 00:19:01 sjboddie 15 some changes to the way quoted queries are handled 16 14 17 Revision 1.12 1999/07/09 02:17:55 rjmcnab 15 18 Setting macros needed for a second query. … … 282 285 } 283 286 284 void queryaction::define_internal_macros (displayclass & /*disp*/, cgiargsclass &/*args*/,287 void queryaction::define_internal_macros (displayclass &disp, cgiargsclass &args, 285 288 recptproto */*collectproto*/, ostream &/*logout*/) { 286 289 287 // define_internal_macros doesn't set anything for this action. The following 288 // macros are set later though in define_query_macros (they can't be set until 289 // the query has been done). 290 // define_internal_macros doesn't sets the following macros. 291 292 // _quotedquery_ the part of the query string that was quoted for post-processing 293 294 295 296 // The following macros are set later (in define_query_macros) as they can't be set until 297 // the query has been done. 290 298 291 299 // _freqmsg_ the term frequency string 292 293 // _quotedquery_ the part of the query string that was quoted for post-processing294 300 295 301 // _resultline_ the "x documents matched the query" string … … 301 307 // _thisfirst_ 302 308 // _thislast_ 303 309 310 311 312 // get the quoted bits of the query string and set _quotedquery_ 313 text_t &arg_q = args["q"]; 314 if (!arg_q.empty()) { 315 316 text_t::const_iterator end = arg_q.end(); 317 text_t::const_iterator here = findchar (arg_q.begin(), end, '\"'); 318 if (here != end) { 319 text_t quotedquery, tmptext; 320 bool first = true; 321 bool foundquote = false; 322 while (here != end) { 323 if (*here == '\"') { 324 if (foundquote) { 325 if (!tmptext.empty()) { 326 if (!first) quotedquery += " and "; 327 else first = false; 328 quotedquery += "\"" + tmptext + "\""; 329 tmptext.clear(); 330 } 331 foundquote = false; 332 } else foundquote = true; 333 } else { 334 if (foundquote) tmptext.push_back (*here); 335 } 336 here ++; 337 } 338 disp.setmacro ("quotedquery", "query", quotedquery); 339 } 340 } 304 341 } 305 342 … … 405 442 FilterRequest_t request; 406 443 FilterResponse_t response; 407 text_t quotedstring;408 444 format_t *formatlistptr = new format_t(); 409 445 … … 412 448 // do the query 413 449 request.filterResultOptions = FROID | FRmetadata | FRtermFreq; 414 if (!do_query (request, args, collectproto, quotedstring,response, logout))450 if (!do_query (request, args, collectproto, response, logout)) 415 451 return false; 416 452 417 453 // set macros 418 define_query_macros (args, disp, response , quotedstring);454 define_query_macros (args, disp, response); 419 455 420 456 // output the header … … 430 466 textout << outconvert << disp << "<tr>\n" 431 467 432 // << "<td valign=top nowrap>r: " << (*this_doc).ranking433 // << " t: " << (*this_doc).num_terms_matched << " p: "434 // << (*this_doc).num_phrase_match << "</td>\n"468 // << "<td valign=top nowrap>r: " << (*this_doc).ranking 469 // << " t: " << (*this_doc).num_terms_matched << " p: " 470 // << (*this_doc).num_phrase_match << "</td>\n" 435 471 436 472 << get_formatted_string (*this_doc, formatlistptr) << "\n" … … 454 490 // _thisfirst_, and _thislast_ 455 491 void queryaction::define_query_macros (cgiargsclass &args, displayclass &disp, 456 const FilterResponse_t &response, 457 const text_t "edstring) { 492 const FilterResponse_t &response) { 458 493 459 494 int numdocs = response.numDocs; … … 472 507 } 473 508 474 disp.setmacro ("quotedquery", "query", quotedstring);475 509 disp.setmacro ("freqmsg", "query", freqmsg); 476 510
Note:
See TracChangeset
for help on using the changeset viewer.