Changeset 8357
- Timestamp:
- 2004-10-18T12:30:06+13:00 (20 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/queryaction.cpp
r8029 r8357 1312 1312 get_formatted_query_string(formattedstring, segment, args, disp, logout); 1313 1313 1314 1315 1314 if (!formattedstring.empty()) { // do the query 1316 1315 // note! formattedstring is in unicode! mg and mgpp must convert! … … 1397 1396 // remove & | ! for simple search,do segmentation if necessary 1398 1397 format_querystring (formattedstring, args.getintarg("b"), segment); 1399 if (args["ct"]=="1") { // mgpp - we need to add in the field info 1400 mgpp_format_field_info(formattedstring, args["fqf"]); 1401 } 1402 else if (args["ct"]=="2") { // lucene - we need to add in the field info 1403 lucene_format_field_info(formattedstring, args["fqf"]); 1398 if (args["ct"]!=0) { // mgpp and lucene - need to add in tag info if appropriate 1399 format_field_info(formattedstring, args); 1404 1400 } 1405 1401 … … 1408 1404 args.getintarg("ct")); 1409 1405 args["q"] = formattedstring; 1406 1410 1407 } 1411 1408 else if (args["qt"]=="1" || args["qto"]=="2"){ // form search -
trunk/gsdl/src/recpt/querytools.cpp
r8029 r8357 608 608 609 609 610 void mgpp_format_field_info(text_t & querystring, const text_t &tag) { 611 610 void add_field_info(text_t &querystring, const text_t &tag, int type) { 611 612 if (type == 1) { //mgpp 613 querystring = "["+querystring+"]:"+tag; 614 } else if (type == 2) { // lucene 615 querystring = tag+":("+querystring+")"; 616 } 617 618 } 619 620 621 void format_field_info(text_t &querystring, cgiargsclass &args) { 622 623 text_t tag = args["fqf"]; 612 624 if (tag == "ZZ" || tag == "") { 613 625 return; // do nothing 614 626 } 615 616 querystring = "["+querystring+"]:"+tag; 617 } 618 619 void lucene_format_field_info(text_t & querystring, const text_t &tag) { 620 621 if (tag == "ZZ" || tag == "") { 622 return; // do nothing 623 } 624 625 querystring = tag+":("+querystring+")"; 626 } 627 628 int argct = args.getintarg("ct"); 629 int argt = args.getintarg("t");// t=0 -and, t=1 - or 630 int argb = args.getintarg("b"); // b=0 simple, b=1 advanced 631 632 if (argb==0 && argt==0) { 633 // simple 'and' search - just put tag info round whole query string 634 add_field_info(querystring, tag, argct); 635 return; 636 } 637 638 // we need to individually tag words 639 text_t outtext; 640 text_t word; 641 //unsigned short c; 642 text_t::const_iterator here = querystring.begin(); 643 text_t::const_iterator end = querystring.end(); 644 645 while (here !=end) { 646 647 if (is_unicode_letdig(*here)|| *here == '#' || *here == '/' ) { 648 // include term modifiers in a word just in case 649 // not word boundary 650 word.push_back(*here); 651 here++; 652 } 653 else { 654 // found word boundary 655 if (!word.empty() ) { 656 add_field_info(word, tag, argct); 657 outtext += word; 658 word.clear(); 659 } 660 // everything else, we add into the query string 661 outtext.push_back(*here); 662 here++; 663 } 664 } 665 666 // get last word 667 if (!word.empty()) { 668 add_field_info(word, tag, argct); 669 outtext += word; 670 } 671 672 querystring = outtext; 673 } 674 -
trunk/gsdl/src/recpt/querytools.h
r8029 r8357 68 68 text_t addstemcase(const text_t &terms, const text_t &stem, const text_t &fold); 69 69 text_t formatelem(text_t &text); 70 void mgpp_format_field_info(text_t &querystring, const text_t &tag); 71 void lucene_format_field_info(text_t &querystring, const text_t &tag); 72 70 void format_field_info(text_t &querystring, cgiargsclass &args); 73 71 #endif
Note:
See TracChangeset
for help on using the changeset viewer.