Changeset 11964


Ignore:
Timestamp:
2006-06-22T14:37:57+12:00 (18 years ago)
Author:
kjdon
Message:

changed the collection_macros data type to be collectionmeta_map, so get macro_name -> params -> value. This way we can set the value with no params to be the first value we come across, and if we find a genuine no-params value later on, it will overwrite it. collection macros and collection meta no loonger written to the gdbm database

Location:
trunk/gsdl/src
Files:
3 edited

Legend:

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

    r10789 r11964  
    9898    else if (key == "numbytes") collectinfo.numBytes = value.getint();
    9999    else if (key == "collectionmeta") {
     100      // genuine collmeta get added as collectionmeta and collection_macros
     101      // .collmeta just get added as collection_macros
    100102      text_t params;
    101103      if (cfgline.size() == 3) {
     
    138140     
    139141      // add all collectionmeta to macro list
    140       if (cfgline.size() == 2) // no params for this macro
    141     collectinfo.collection_macros
    142       .insert( make_pair(meta_name, make_pair(g_EmptyText,cfgline[1])) );
     142      text_tmap params_map = collectinfo.collection_macros[meta_name];
     143     
     144      if (cfgline.size() == 2) {// no params for this macro
     145    params_map[g_EmptyText] = cfgline[1];
     146      }
    143147      else if (cfgline.size() == 3) {// has params
    144     // can we somehow add this is with no params if there is not already
    145     // a no params entry??
    146     collectinfo.collection_macros
    147       .insert( make_pair(meta_name, make_pair(params,cfgline[2])) );
    148       }
     148    params_map[params] = cfgline[2];
     149    if (params_map[g_EmptyText].empty()) {
     150      params_map[g_EmptyText] = cfgline[2];
     151    }
     152      }
     153      collectinfo.collection_macros[meta_name] = params_map;
    149154    }
    150155    else if (key == "collectionmacro") {
    151156      text_t nobrackets;
     157      text_tmap params_map = collectinfo.collection_macros[cfgline[0]];
    152158      // add all to macro list
    153       if (cfgline.size() == 2) // no params for this macro
    154     collectinfo.collection_macros
    155       .insert( make_pair(cfgline[0], make_pair(g_EmptyText,cfgline[1])) );
     159      if (cfgline.size() == 2) { // no params for this macro
     160    params_map[g_EmptyText] = cfgline[1];
     161      }
    156162      else if (cfgline.size() == 3) {// has params
    157163    // strip [ ] brackets from params
     
    159165    text_t::const_iterator last=cfgline[1].end()-1;
    160166    nobrackets=substr(first, last);
    161     collectinfo.collection_macros
    162       .insert( make_pair(cfgline[0], make_pair(nobrackets,cfgline[2])) );
    163       }
     167    params_map[nobrackets] = cfgline[2];
     168      }
     169      collectinfo.collection_macros[cfgline[0]] = params_map;
     170     
    164171    } else if (key == "format" && cfgline.size() == 2)
    165172      collectinfo.format[cfgline[0]] = cfgline[1];
  • trunk/gsdl/src/recpt/comtypes.h

    r10789 r11964  
    6767};
    6868
    69 /* macro name -> (params, value) */
    70 typedef multimap<text_t, pair<text_t, text_t>, less<text_t> > macros_map;
    71 
    72 typedef map<text_t, text_tmap, lttext_t> collectionmeta_map; // maps meta name to langmap
     69// for collection metadata: metadata name -> lang -> value
     70// for collection macros: macro name -> params -> value
     71typedef map<text_t, text_tmap, lttext_t> collectionmeta_map;
    7372
    7473#define CCSUniformSearchResultsFormatting 1
     
    9190  unsigned long numWords;    // 0 if not known
    9291  unsigned long numBytes;    // 0 if not known
    93   //text_tmap      collectionmeta;
    9492  collectionmeta_map  collectionmeta;
    9593  text_tmap      format;
    96   macros_map     collection_macros; // for collectionmacro config directive (> gsdl 2.53)
     94  collectionmeta_map     collection_macros; // for collectionmacro config directive (> gsdl 2.53)
    9795  text_tmap      building;
    9896  text_t         httpdomain;      // GRB: could these two http items need removing
  • trunk/gsdl/src/recpt/receptionist.cpp

    r10931 r11964  
    15191519      // as of gsdl 2.53, collect.cfg can specify macros
    15201520      if (cinfo.collection_macros.size() > 0) {
    1521     macros_map::const_iterator this_macro=cinfo.collection_macros.begin();
    1522     macros_map::const_iterator done_macro=cinfo.collection_macros.end();
     1521    collectionmeta_map::const_iterator this_macro=cinfo.collection_macros.begin();
     1522    collectionmeta_map::const_iterator done_macro=cinfo.collection_macros.end();
    15231523    while (this_macro != done_macro) {
    15241524      text_t package = "Global";
     
    15371537      }
    15381538
    1539       disp.setcollectionmacro(package,
    1540                   macroname,
    1541                   this_macro->second.first,   // params
    1542                   this_macro->second.second); // value
     1539      text_tmap params_map = this_macro->second;
     1540      text_tmap::const_iterator this_param = params_map.begin();
     1541      text_tmap::const_iterator done_param = params_map.end();
     1542      while (this_param != done_param) {
     1543        disp.setcollectionmacro(package,
     1544                    macroname,
     1545                    this_param->first,
     1546                    this_param->second);
     1547        ++this_param;
     1548      }
     1549     
    15431550      ++this_macro;
    15441551    }
Note: See TracChangeset for help on using the changeset viewer.