Changeset 2697 for trunk/gsdl


Ignore:
Timestamp:
2001-08-13T13:13:06+12:00 (23 years ago)
Author:
kjm18
Message:

keep a pointer to an IndexData structure so keep state between queries.
will only work for persistant libraries, but should speed up queries
that are on the same index and level as the previous query

Location:
trunk/gsdl/src/colservr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/mgppsearch.cpp

    r2679 r2697  
    6363      cache = NULL;
    6464    }
     65
     66  if (indexData !=NULL) {
     67    indexData->UnloadData();
     68    delete indexData;
     69    indexData = NULL;
     70  }
     71 
    6572}
    6673
     
    7784
    7885  // load index data
    79   IndexData indexData;
    80   if (!indexData.LoadData (basepath, indexname)) {
     86  if (indexData == NULL) {
     87    indexData = new IndexData();
     88  }
     89  if (!indexData->LoadData (basepath, indexname)) {
    8190    cerr<<"couldn't load index data\n"<<endl;
    8291    return false;
     
    126135 
    127136  // do the query
    128   MGQuery(indexData, queryInfo, queryTree, queryResult, level);
     137  MGQuery(*indexData, queryInfo, queryTree, queryResult, level);
    129138 
    130139 
     
    169178  }
    170179  // clean up
    171   indexData.UnloadData();
     180  //indexData.UnloadData(); - leave it cached for next query
    172181  delete indexname;
    173182  return true;
     
    182191  char *indexname = (getindexsuffix(queryparams)).getcstr();
    183192 
    184   IndexData indexData;
    185   if (!indexData.LoadData (basepath, indexname)) {
     193  //IndexData indexData;
     194  if (indexData == NULL) {
     195    indexData = new IndexData();
     196  }
     197  if (!indexData->LoadData (basepath, indexname)) {
    186198    cerr<<"couldn't load index data\n"<<endl;
    187199    return false;
     
    205217
    206218  // do the actual query
    207   MGBrowseQuery(indexData, level, browseNode, browseResult);
     219  MGBrowseQuery(*indexData, level, browseNode, browseResult);
    208220
    209221  // load results into term info
     
    219231  }
    220232  // clean up
    221   indexData.UnloadData();
     233  //indexData.UnloadData();
    222234  delete indexname;
    223235
  • trunk/gsdl/src/colservr/mgppsearch.h

    r2679 r2697  
    3131
    3232#include "search.h"
     33#include "IndexData.h"
    3334
    3435class mgppsearchclass : public searchclass {
     
    3839
    3940  virtual text_t get_mg_type() {return "mgpp";}
    40  
     41
    4142  // the search results are returned in queryresults
    4243  // search returns 'true' if it was able to do a search
     
    7576  */
    7677  void set_gdbm_level(text_t &level);
    77  
     78
    7879  // used to clear any cached databases for persistent versions of
    7980  // Greenstone like the Windows local library
    8081  void unload_database ();
    81 
    8282 protected:
    8383  text_t gdbm_level; // the level used in gdbm file (usu. Section, but may be
    8484                     // Document)
     85
     86  IndexData *indexData; // the index data structure needed for MGQuery - keep
     87  // as a cache
    8588
    8689};
Note: See TracChangeset for help on using the changeset viewer.