Changeset 10567


Ignore:
Timestamp:
2005-08-25T17:02:29+12:00 (19 years ago)
Author:
kjdon
Message:

added checks for no childtype metadata - this occurs when it is erroneously thinking a document is hierarchical when it is not. see wiki entry in greenstone bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/browsetools.cpp

    r10553 r10567  
    384384  while (thisdoc != lastdoc) {
    385385
    386     if (is_top ((*thisdoc).OID))
     386    if (is_top ((*thisdoc).OID)) {
    387387      load_formatstring ((*thisdoc).metadata["thistype"].values[0], metadata,
    388388             getParents, classification, browsermap, formatinfo,
    389389             formatlistmap);
    390 
    391     text_t &childtype = (*thisdoc).metadata["childtype"].values[0];
    392     text_tset::const_iterator it = cache.find (childtype);
    393     if (it == cache.end()) {
    394       load_formatstring (childtype, metadata, getParents, classification,
    395              browsermap, formatinfo, formatlistmap);
    396       cache.insert (childtype);
     390    }
     391   
     392    // sometimes childtype is not set - why??
     393    if ((*thisdoc).metadata.find("childtype") != (*thisdoc).metadata.end()) {
     394      text_t &childtype = (*thisdoc).metadata["childtype"].values[0];
     395
     396      text_tset::const_iterator it = cache.find (childtype);
     397      if (it == cache.end()) {
     398    load_formatstring (childtype, metadata, getParents, classification,
     399               browsermap, formatinfo, formatlistmap);
     400    cache.insert (childtype);
     401      }
    397402    }
    398403    ++thisdoc;
     
    417422    // get classifytype of this level
    418423    if (is_top ((*thisparent).OID)) classifytype = (*thisparent).metadata["thistype"].values[0];
    419     else if (!first) classifytype = (*(thisparent-1)).metadata["childtype"].values[0];
     424    else if (!first && (*(thisparent-1)).metadata.find("childtype") != (*(thisparent-1)).metadata.end()) classifytype = (*(thisparent-1)).metadata["childtype"].values[0];
    420425   
    421426    // if we still don't have a classifytype we'll use the default
     
    516521  text_t classifytype;
    517522  int numparents = response.docInfo.size();
    518   if (!parents.empty())
     523  if (!parents.empty() && (response.docInfo[numparents-1].metadata.find("childtype") != response.docInfo[numparents-1].metadata.end()))
    519524    classifytype = response.docInfo[numparents-1].metadata["childtype"].values[0];
    520525  else {
Note: See TracChangeset for help on using the changeset viewer.