Ignore:
Timestamp:
2000-04-05T03:02:39+12:00 (24 years ago)
Author:
cs025
Message:

Corba first commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/corba/gsdl/src/colservr/mgsearch.cpp

    r633 r1067  
    2828/*
    2929   $Log$
     30   Revision 1.22.2.1  2000/04/04 15:02:32  cs025
     31   Corba first commit
     32
    3033   Revision 1.22  1999/09/24 02:41:21  rjmcnab
    3134   change to use has_unicode_letdig in text_t
     
    391394}
    392395
    393 
     396/**
     397 * search directs the whole execution of the search; a number of other
     398 * functions in this class are called as a result, and precondition
     399 * checks are also made
     400 */
    394401bool mgsearchclass::search(const queryparamclass &queryparams,
    395402               queryresultsclass &queryresults) {
    396403  assert (cache != NULL);
    397404
     405  // clear any previous results
    398406  queryresults.clear();
    399407
     
    406414  if (makeindexcurrent (queryparams.index, queryparams.subcollection,
    407415            queryparams.language, queryparams.collection)) {
     416    // initialise the form of results
    408417    setsearchmode (queryparams);
     418
     419    // execute the query
    409420    submitquery (queryparams);
     421
     422    // retrieve the results
    410423    getresults (queryparams, queryresults);
     424
    411425    return true;
    412426  }
     
    453467}
    454468
    455 
     469/**
     470 * submitquery constructs the query string (into UTF8 encoding)
     471 * and submits it using mgq_ask to the mg search engine.  Most
     472 * of the processing will be done inside Greenstone
     473 */
    456474void mgsearchclass::submitquery (const queryparamclass &queryparams)
    457475{
    458   // sort out the query string
     476  // sort out the query string; copy it, remove all special characters
     477  // and then convert it to a string in UTF8 format
    459478  text_t ttquerystring = queryparams.querystring;
    460479  filterquery (ttquerystring);
     
    464483  mgq_ask(querystring);
    465484
     485  // destroy the temporary character array
    466486  delete querystring;
    467487}
    468488
    469 
     489/**
     490 * getrults is called to retrieve the required data on the docs
     491 * which responded to the query submitted in submitquery above.
     492 *
     493 * It calls the local mgquery (mgq) interface to MG several times,
     494 * to obtain the document numbers, term frequencies, term variants
     495 * etc.  All processing of the query will be done by Greenstone
     496 * thereafter
     497 */
    470498void mgsearchclass::getresults (const queryparamclass &queryparams,
    471499                queryresultsclass &queryresults) {
    472 
     500  // get the configuration for the maximum number of documents to
     501  // retrieve
    473502  int howmany = queryparams.maxdocs;
    474503  if (howmany == -1) howmany = MAXNUMDOCS;
     
    504533}
    505534
     535/**
     536 * Tidies the given querystring, removing special characters
     537 */
    506538void mgsearchclass::filterquery (text_t &ttquerystring) {
    507539  text_t::iterator ithere = ttquerystring.begin ();
Note: See TracChangeset for help on using the changeset viewer.