Changeset 8357 for trunk/gsdl/src/recpt/querytools.cpp
- Timestamp:
- 2004-10-18T12:30:06+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.