Changeset 10411
- Timestamp:
- 2005-08-03T18:02:41+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/querytools.cpp
r9620 r10411 632 632 int argb = args.getintarg("b"); // b=0 simple, b=1 advanced 633 633 634 // Special code for Lucene 635 // The default operator for Lucene is "or", so we need to add "+" symbols when t == 0 636 // Also, we need to be careful not to mess up phrase searches 637 if (argct == 2) { 638 text_t processed_querystring = ""; 639 text_t queryelement = ""; 640 text_t combine = ((argt == 0) ? "+" : ""); 641 bool in_phrase = false; 642 text_t::const_iterator here = querystring.begin(); 643 text_t::const_iterator end = querystring.end(); 644 while (here != end) { 645 if (is_unicode_letdig(*here)) { 646 queryelement.push_back(*here); 647 } 648 649 // Detect phrase starts/finishes 650 else if (*here == '"') { 651 queryelement.push_back(*here); 652 if (in_phrase == false) in_phrase = true; 653 else if (in_phrase == true) { 654 add_field_info(queryelement, tag, argct); 655 processed_querystring += combine + queryelement; 656 queryelement.clear(); 657 in_phrase = false; 658 } 659 } 660 661 // Found word boundary 662 else if (in_phrase) { 663 queryelement.push_back(*here); 664 } 665 else { 666 if (!queryelement.empty()) { 667 add_field_info(queryelement, tag, argct); 668 processed_querystring += combine + queryelement; 669 queryelement.clear(); 670 } 671 processed_querystring.push_back(*here); 672 } 673 674 ++here; 675 } 676 677 // Get last element 678 if (!queryelement.empty()) { 679 add_field_info(queryelement, tag, argct); 680 processed_querystring += combine + queryelement; 681 } 682 683 querystring = processed_querystring; 684 return; 685 } 686 634 687 if (argb==0 && argt==0) { 635 688 // simple 'and' search - just put tag info round whole query string … … 671 724 outtext += word; 672 725 } 673 726 674 727 querystring = outtext; 675 728 }
Note:
See TracChangeset
for help on using the changeset viewer.