- Timestamp:
- 2013-09-05T13:35:43+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/recpt/querytools.cpp
r27066 r28221 519 519 } 520 520 521 // Parses the terms into words, and adds #si if necessary522 text_t addstemcase(const text_t &terms, const text_t &stem, const text_t & fold,521 // Parses the terms into words, and adds #sif if necessary 522 text_t addstemcase(const text_t &terms, const text_t &stem, const text_t &casefold, const text_t &accentfold, 523 523 const int indexer_type) { 524 524 525 // the default stem and case are set to 0 if this is being used, so we are only adding on qualifiers if stem or foldis 1.526 if (stem == "0" && fold =="0") {525 // the default stem, case and accentfold are set to 0 if this is being used, so we are only adding on qualifiers if stem,case,accent is 1. 526 if (stem == "0" && casefold == "0" && accentfold =="0") { 527 527 return terms; 528 528 } … … 537 537 text_t::const_iterator here = terms.begin(); 538 538 text_t::const_iterator end = terms.end(); 539 540 text_t word_modifier = "#"; 541 if (stem == "1") word_modifier += "s"; 542 if (casefold == "1") word_modifier += "i"; 543 if (accentfold == "1") word_modifier += "f"; 539 544 540 545 while (here !=end) { … … 553 558 } 554 559 else { 555 word += "#"; 556 if (stem == "1") word += "s"; 557 if (fold == "1") word += "i"; 558 outtext += word; 560 outtext += word+word_modifier; 559 561 word.clear(); 560 562 } … … 571 573 // get last word 572 574 if (!word.empty()) { 573 word += "#"; 574 if (stem == "1") word += "s"; 575 if (fold == "1") word += "i"; 576 word += " "; 577 outtext += word; 575 outtext += word+word_modifier+" "; 578 576 } 579 577 return outtext; … … 667 665 668 666 text_tarray stems; 669 text_tarray folds; 667 text_tarray casefolds; 668 text_tarray accentfolds; 670 669 if (argct == 1) {// mgpp - lucene doesn't do stem/case 671 text_t stem = args["fqs"]; 672 if (stem.empty()) return; // somethings wrong 673 splitchar(stem.begin(), stem.end(), ',', stems); 674 675 text_t fold = args["fqk"]; 676 if (fold.empty()) return; // somethings wrong 677 splitchar(fold.begin(), fold.end(), ',', folds); 670 if (args["ss"]=="1") { //collection has stemming 671 text_t stem = args["fqs"]; 672 if (stem.empty()) return; // somethings wrong 673 splitchar(stem.begin(), stem.end(), ',', stems); 674 } 675 if (args["ks"]=="1") { // collection has case folding 676 text_t fold = args["fqk"]; 677 if (fold.empty()) return; // somethings wrong 678 splitchar(fold.begin(), fold.end(), ',', casefolds); 679 } 680 if (args["afs"]=="1") { 681 text_t accent = args["fqaf"]; 682 if (accent.empty()) return; // somethings wrong 683 splitchar(accent.begin(), accent.end(), ',', accentfolds); 684 } 678 685 } 679 686 … … 696 703 format_querystring(this_value, argb, segment); 697 704 if (argct == 1) { // mgpp only 698 this_value = addstemcase(this_value, stems[i], folds[i], argct);705 this_value = addstemcase(this_value, ((args["ss"]=="1")?stems[i]:"0"), ((args["ks"]=="1")?casefolds[i]:"0"), ((args["afs"]=="1")?accentfolds[i]:"0"), argct); 699 706 } 700 707 // add tag info for this field (and other processing)
Note:
See TracChangeset
for help on using the changeset viewer.