- Timestamp:
- 2004-04-07T16:12:21+12:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/queryaction.cpp
r7067 r7197 551 551 // define_internal_macros sets the following macros: 552 552 553 // _quotedquery_ the part of the query string that was quoted for post-processing554 555 556 557 553 // The following macros are set later (in define_query_macros) as they can't be set until 558 554 // the query has been done. 559 555 // _quotedquery_ the part of the query string that was quoted for post-processing 560 556 // _freqmsg_ the term frequency string 561 557 … … 568 564 // _thisfirst_ 569 565 // _thislast_ 570 571 if (args["ct"]==0) { // mg queries only, not mgpp572 // get the quoted bits of the query string and set _quotedquery_573 text_tarray phrases;574 get_phrases (args["q"], phrases);575 num_phrases = phrases.size();576 text_tarray::const_iterator phere = phrases.begin();577 text_tarray::const_iterator pend = phrases.end();578 bool first = true;579 text_t quotedquery;580 while (phere != pend) {581 if (!first)582 if ((phere +1) == pend) quotedquery += " and ";583 else quotedquery += ", ";584 585 quotedquery += "\"" + *phere + "\"";586 first = false;587 phere ++;588 }589 if (args.getintarg("s") && !quotedquery.empty()) quotedquery += "_textstemon_";590 disp.setmacro ("quotedquery", "query", quotedquery);591 }592 566 593 567 define_form_macros(disp, args, protos, logout); … … 1374 1348 if (args["qt"]=="0" && args["qto"] != "2") { // normal text search 1375 1349 formattedstring = args["q"]; 1376 // remove & | ! for simple search, insert spaces for chinese1350 // remove & | ! for simple search,do segmentation if necessary 1377 1351 format_querystring (formattedstring, args.getintarg("b"), segment); 1378 1352 if (args["ct"]=="1") { // mgpp - we need to add in the field info … … 1394 1368 parse_adv_query_form(formattedstring, args); 1395 1369 } 1396 args["q"] = formattedstring;1397 1398 1370 // reset the cgiargfqv macro - need to escape any quotes in it 1399 1371 disp.setmacro("cgiargfqv", "query", escape_quotes(args["fqv"])); 1400 1401 // also reset the _cgiargq_ macro as it has changed now 1402 disp.setmacro("cgiargq", "Global", html_safe(args["q"])); 1403 1404 // reset the compressed options to include the q arg 1405 text_t compressedoptions = recpt->get_compressed_arg(args, logout); 1406 if (!compressedoptions.empty()) { 1407 disp.setmacro ("compressedoptions", "Global", dm_safe(compressedoptions)); 1408 // need a decoded version of compressedoptions for use within forms 1409 // as browsers encode values from forms before sending to server 1410 // (e.g. %25 becomes %2525) 1411 decode_cgi_arg (compressedoptions); 1412 disp.setmacro ("decodedcompressedoptions", "Global", dm_safe(compressedoptions)); 1413 } 1414 } // form search 1415 } // args["qt"]=1 1416 else { 1372 } 1373 } else { 1417 1374 logout << "ERROR (query_action::get_formatted_query_string): querytype not defined\n"; 1375 return; 1376 } 1377 1378 // reset the query arg in case it has changed 1379 args["q"] = formattedstring; 1380 1381 // also reset the _cgiargq_ macro as it has changed now 1382 disp.setmacro("cgiargq", "Global", html_safe(args["q"])); 1383 1384 // reset the compressed options to include the q arg 1385 text_t compressedoptions = recpt->get_compressed_arg(args, logout); 1386 if (!compressedoptions.empty()) { 1387 disp.setmacro ("compressedoptions", "Global", dm_safe(compressedoptions)); 1388 // need a decoded version of compressedoptions for use within forms 1389 // as browsers encode values from forms before sending to server 1390 // (e.g. %25 becomes %2525) 1391 decode_cgi_arg (compressedoptions); 1392 disp.setmacro ("decodedcompressedoptions", "Global", dm_safe(compressedoptions)); 1418 1393 } 1419 1394 } … … 1473 1448 disp.setmacro ("nextlast", "query", nextlast); 1474 1449 } 1450 1451 // do quoted query here cos we may have added quotes during query pre-processing 1452 if (args["ct"]==0) { // mg queries only, not mgpp 1453 // get the quoted bits of the query string and set _quotedquery_ 1454 text_tarray phrases; 1455 get_phrases (args["q"], phrases); 1456 num_phrases = phrases.size(); 1457 text_tarray::const_iterator phere = phrases.begin(); 1458 text_tarray::const_iterator pend = phrases.end(); 1459 bool first = true; 1460 text_t quotedquery; 1461 while (phere != pend) { 1462 if (!first) 1463 if ((phere +1) == pend) quotedquery += " and "; 1464 else quotedquery += ", "; 1465 1466 quotedquery += "\"" + *phere + "\""; 1467 first = false; 1468 phere ++; 1469 } 1470 if (args.getintarg("s") && !quotedquery.empty()) quotedquery += "_textstemon_"; 1471 disp.setmacro ("quotedquery", "query", quotedquery); 1472 } 1473 1475 1474 } 1476 1475
Note:
See TracChangeset
for help on using the changeset viewer.