Ignore:
Timestamp:
2002-06-21T14:42:45+12:00 (22 years ago)
Author:
kjdon
Message:

no longer format query strings inside fields. two or more words are now
ANDed together, not considered a phrase.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/querytools.cpp

    r3149 r3160  
    290290}
    291291
    292 // search history tool
     292// search history tool
     293// also used for form query macros
    293294text_t escape_quotes(const text_t &querystring) {
    294295
     
    334335  for (int i=0; i< values.size(); i++) {
    335336    if (!values[i].empty()) {
    336       text_t text = formatelem(values[i]);
    337       addqueryelem(querystring, fields[i], text, combine);
    338     }
    339   }
    340  
    341 }
    342 
    343 text_t formatelem(text_t &text) {
    344 
    345   text_t::iterator here = text.begin();
    346   text_t::iterator end = text.end();
    347 
    348   bool space = false;
    349   int words = 0;
    350   text_t newtext = "";
    351   while (here != end) {
    352     if (is_unicode_letdig(*here)) {
    353       newtext.push_back(*here);
    354       if (space==false) words++;
    355       space = true;
    356     }
    357     else {
    358       if (space) {
    359     newtext.push_back(' ');
    360     space = false;
    361       }
    362     }
    363     here++;
    364   }
    365 
    366   if (words > 1) { // have a phrase, put it in quotes
    367     newtext = "\""+newtext+"\"";
    368   }
    369   return newtext;
    370 }
     337      addqueryelem(querystring, fields[i], values[i], combine);
     338    }
     339  }
     340 
     341}
     342
    371343
    372344void parse_adv_query_form(text_t &querystring, cgiargsclass &args){
     
    407379    else if (combs[i-1]=="not")combine = "!";
    408380      }
    409       text_t term = formatelem(values[i]);
    410       term = addstemcase(term, stems[i], folds[i]);
     381      text_t term = addstemcase(values[i], stems[i], folds[i]);
    411382      addqueryelem(querystring, fields[i], term, combine);
    412383    }
     
    477448 
    478449  }
    479   if (tag=="ZZ") { // just add onto querystring
     450  if (tag=="ZZ" || tag=="") { // just add onto querystring
    480451       querystring +=  query;
    481452  }
Note: See TracChangeset for help on using the changeset viewer.