Changeset 20481


Ignore:
Timestamp:
2009-09-02T15:49:49+12:00 (15 years ago)
Author:
kjdon
Message:

added get_plain_query_terms method to querytools (only partially implemented so far), and use it in queryaction to clean up the q arg and save as _queryterms_ macro - used for PDF search parameter

Location:
gsdl/trunk/runtime-src/src/recpt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/runtime-src/src/recpt/queryaction.cpp

    r17938 r20481  
    809809    }
    810810      }
     811    }
     812
     813    // add a queryterms macro for plain version of search terms
     814    if (!args["q"].empty()) {
     815      disp.setmacro ("queryterms", displayclass::defaultpackage, get_plain_query_terms(args["q"]));
    811816    }
    812817  }
     
    16501655      // also reset the _cgiargq_ macro as it has changed now
    16511656      disp.setmacro("cgiargq", displayclass::defaultpackage, html_safe(args["q"]));
    1652      
     1657
    16531658      // reset the compressed options to include the q arg
    16541659      text_t compressedoptions = recpt->get_compressed_arg(args, logout);
  • gsdl/trunk/runtime-src/src/recpt/querytools.cpp

    r18459 r20481  
    332332}
    333333
    334 
    335    
     334// turn query string into terms separated by spaces.
     335// still working on this...
     336text_t get_plain_query_terms(const text_t &querystring) {
     337
     338  text_t::const_iterator here = querystring.begin();
     339  text_t::const_iterator end = querystring.end();
     340  text_t terms = "";
     341  bool space = false;
     342  while (here != end) {
     343    if (*here ==  '#' || *here == '/') {
     344      // skip over #is /10 etc
     345      ++here;
     346      while (here != end && *here != ' ') {
     347    ++here;
     348      }
     349      if (here == end) break;
     350    }
     351    if (*here == '[') {
     352      // get the text out and ignore the :TI after
     353    }
     354    if (is_unicode_letdig(*here)) {
     355      terms.push_back(*here);
     356      space = false;
     357    } else {
     358      if (!space) {
     359    terms.push_back(' ');
     360    space = true;
     361      }
     362    }
     363    ++here;
     364  }
     365  return terms;
     366   
     367}
    336368
    337369// search history tool
  • gsdl/trunk/runtime-src/src/recpt/querytools.h

    r12864 r20481  
    4848           int startbc, int endbc, int ct);
    4949
     50// get a plain version of the query string - terms, separated by space
     51text_t get_plain_query_terms(const text_t &querystring);
     52
    5053// search history tool
    5154text_t escape_quotes(const text_t &querystring);
Note: See TracChangeset for help on using the changeset viewer.