Changeset 238


Ignore:
Timestamp:
1999-04-20T11:56:10+12:00 (25 years ago)
Author:
rjmcnab
Message:

Finished the gdbm metadata stuff

Location:
trunk/gsdl/src
Files:
5 edited

Legend:

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

    r227 r238  
    1212/*
    1313   $Log$
     14   Revision 1.2  1999/04/19 23:56:05  rjmcnab
     15   Finished the gdbm metadata stuff
     16
    1417   Revision 1.1  1999/04/06 22:22:08  rjmcnab
    1518   Initial revision.
     
    3235  filtopt.defaultValue = "1";
    3336  filtopt.validValues.push_back("1");
    34   filtopt.validValues.push_back("1000");
     37  filtopt.validValues.push_back("10000");
    3538  filterOptions["StartResults"] = filtopt;
    3639
     
    4043  filtopt.type = FilterOption_t::integert;
    4144  filtopt.repeatable = FilterOption_t::onePerQuery;
    42   filtopt.defaultValue = "10";
     45  filtopt.defaultValue = "10000";
    4346  filtopt.validValues.push_back("1");
    44   filtopt.validValues.push_back("1000");
     47  filtopt.validValues.push_back("10000");
    4548  filterOptions["EndResults"] = filtopt;
    4649
     
    8285                FilterResponse_t &response,
    8386                comerror_t &err, ostream &logout) {
     87  int numDocs = 0;
    8488  outconvertclass text_t2ascii;
    8589
     
    170174
    171175      // create the response
     176      numDocs = resultset.size();
    172177      int resultnum = 1;
    173178      ResultDocInfo_t resultdoc;
     
    188193  }
    189194
    190   response.numDocs = response.docInfo.size();
     195  response.numDocs = numDocs;
    191196  response.isApprox = false;
    192197}
  • trunk/gsdl/src/colservr/mggdbmsource.cpp

    r237 r238  
    1212/*
    1313   $Log$
     14   Revision 1.4  1999/04/19 23:56:07  rjmcnab
     15   Finished the gdbm metadata stuff
     16
    1417   Revision 1.3  1999/04/12 10:30:33  rjmcnab
    1518   Made a little more progress.
     
    7477}
    7578
    76 bool mggdbmsourceclass::get_metadata (const text_t &requestParams, const text_t &refParams,
     79bool mggdbmsourceclass::get_metadata (const text_t &/*requestParams*/, const text_t &/*refParams*/,
    7780                      const text_tarray &fields, const text_t &OID,
    7881                      MetadataInfo_tarray &metadata,
    7982                      comerror_t &err, ostream &logout) {
     83  outconvertclass text_t2ascii;
     84
    8085  metadata.erase(metadata.begin(), metadata.end());
    8186
    8287  err = noError;
    83   return false;
     88  if (gdbmptr == NULL) {
     89    // most likely a configuration problem
     90    logout << text_t2ascii
     91       << "configuration error: mggdbmsource contains a null gdbmclass\n\n";
     92    err = configurationError;
     93    return true;
     94  }
     95
     96  // open the database
     97  gdbmptr->setlogout(&logout);
     98  if (!gdbmptr->opendatabase (gdbm_filename)) {
     99    // most likely a system problem (we have already checked that the
     100    // gdbm database exists)
     101    logout << text_t2ascii
     102       << "system problem: open on gdbm database \""
     103       << gdbm_filename << "\" failed\n\n";
     104    err = systemProblem;
     105    return true;
     106  }
     107
     108  // get the metadata
     109  infodbclass info;
     110  if (!gdbmptr->getinfo(OID, info)) return false;
     111
     112  // adjust the metadata
     113  text_t &contains = info["contains"];
     114  if (contains.empty()) info["haschildren"] = 0;
     115  else info["haschildren"] = 1;
     116  contains.clear();
     117
     118  // collect together the metadata
     119  MetadataInfo_t this_metadata;
     120  text_t *pos_metadata;
     121  text_tarray::const_iterator fields_here = fields.begin();
     122  text_tarray::const_iterator fields_end = fields.end();
     123  while (fields_here != fields_end) {
     124    if (*fields_here != "contains" &&
     125    (pos_metadata = info.getinfo(*fields_here)) != NULL) {
     126      this_metadata.isRef = false;
     127      this_metadata.field = *fields_here;
     128      this_metadata.value = *pos_metadata;
     129      metadata.push_back(this_metadata);
     130    }
     131
     132    fields_here++;
     133  }
     134
     135  return true;
    84136}
     137
  • trunk/gsdl/src/colservr/queryfilter.cpp

    r235 r238  
    1212/*
    1313   $Log$
     14   Revision 1.3  1999/04/19 23:56:09  rjmcnab
     15   Finished the gdbm metadata stuff
     16
    1417   Revision 1.2  1999/04/12 03:45:03  rjmcnab
    1518   Finished the query filter.
     
    339342  }
    340343
    341   response.numDocs = response.docInfo.size();
     344  response.numDocs = queryresults.getnumdocs();
    342345  response.isApprox = (queryresults.getnumdocs() != queryparams.maxdocs);
    343346}
  • trunk/gsdl/src/recpt/librarymain.cpp

    r235 r238  
    1212/*
    1313   $Log$
     14   Revision 1.5  1999/04/19 23:56:10  rjmcnab
     15   Finished the gdbm metadata stuff
     16
    1417   Revision 1.4  1999/04/12 03:45:05  rjmcnab
    1518   Finished the query filter.
     
    3841#include "infodbclass.h"
    3942#include "mgsearch.h"
     43#include "mggdbmsource.h"
    4044#include <assert.h>
    4145
     
    6468  cserver.add_filter (&queryfilter);
    6569
     70  // add a mg and gdbm source
     71  mggdbmsourceclass mggdbmsource;
     72  mggdbmsource.set_gdbmptr (&gdbmhandler);
     73  mggdbmsource.set_mgsearchptr (&mgsearch);
     74  cserver.add_source (&mggdbmsource);
     75
    6676  // inform collection server and everything it contains about its
    6777  // collection name
  • trunk/gsdl/src/txt2db/Makefile

    r202 r238  
    2929RANLIB = ranlib
    3030INCLUDES = -I../../lib
    31 LDFLAGS = -lg++ -lgdbm
    32 LIBS = ../../lib/gsdllib.a ../../packages/mg-1.3d/lib/unitool.o
     31LDFLAGS =
     32LIBS = ../../lib/gsdllib.a ../../packages/mg-1.3d/lib/unitool.o -lstdc++ -lgdbm
    3333GSDLOS = linux
    3434
Note: See TracChangeset for help on using the changeset viewer.