Ignore:
Timestamp:
2017-02-08T18:31:18+13:00 (7 years ago)
Author:
ak19
Message:

Round 1 of commits for getting OAI deletion policy to work with GS2 (server end). The perl code writing out the OAI db and the GS3 server code implementing the deletion policy had already been completed earlier (end 2016).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/colservr/collectserver.cpp

    r29100 r31387  
    515515    thisfilter->filter (request, response, err, logout);
    516516    if (err != noError) return;
     517
    517518    // fill in the metadata for each of the OIDs (if it is requested)
    518519    if (request.filterResultOptions & FRmetadata) {
     520
    519521      bool processed = false;
    520522      ResultDocInfo_tarray::iterator resultdoc_here = response.docInfo.begin();
    521523      ResultDocInfo_tarray::iterator resultdoc_end = response.docInfo.end();
    522524      while (resultdoc_here != resultdoc_end) {
     525
     526    text_t deleted_status = "";
     527    bool append_metadata = (request.filterResultOptions & FROAI) ? true : false;
     528
    523529    // try each of the sources in turn
    524530    sourcelistclass::iterator source_here = sources.begin();
     
    526532    while (source_here != source_end) {
    527533      assert ((*source_here).s != NULL);
     534
     535      // first check for oai metadata from the oai_db, if asked for it (if FROAI is set)
     536      if(((*source_here).s != NULL) &&
     537         request.filterResultOptions & FROAI &&
     538         ((*source_here).s->get_oai_metadata(request.requestParams, request.refParams,
     539                         request.getParents, request.fields,
     540                         (*resultdoc_here).OID, deleted_status, (*resultdoc_here).metadata,
     541                         err, logout))) {
     542       
     543        if (err != noError) return;
     544
     545        processed = true;
     546      }
     547
     548      // We may or may not have got oai_meta (depends on if FROAI was set).
     549      // If we didn't get oai_meta, then deleted_status would still be "".
     550      // If we did get oai_meta, and if the deleted_status for the OID was D for deleted entry,
     551      // don't bother getting any other metadata, as there will be no entry for that OID in index db.
     552     
     553      // Note that if we did get oai_meta and OID marked as existing, we're in append_mode:
     554      // don't let get_metadata() clear the metadata list, as there's already stuff in there
     555      //if(deleted_status == "E") append_metadata = true;
     556
    528557      if (((*source_here).s != NULL) &&
     558          deleted_status != "D" &&
    529559          ((*source_here).s->get_metadata(request.requestParams, request.refParams,
    530560                          request.getParents, request.fields,
    531561                          (*resultdoc_here).OID, (*resultdoc_here).metadata,
    532                           err, logout))) {
    533         if (err != noError) return;
    534         processed = true;
    535         break;
     562                          err, logout, append_metadata))) {
     563        if (err != noError) return; // check for errors again     
     564       
     565        processed = processed || true; // processed would not have been set yet if not doing FROAI. Set now.
     566        // OR-ing isn't necessary, but indicates some consideration of both get oai meta & get meta success
    536567      }
     568     
     569      if(processed) break;
     570
    537571      ++source_here;
    538572    }
     
    548582      }
    549583    } 
    550  
     584   
    551585    err = noError;
    552586  }
Note: See TracChangeset for help on using the changeset viewer.