Changeset 2612


Ignore:
Timestamp:
2001-06-27T17:40:11+12:00 (23 years ago)
Author:
dmm9
Message:

adding filter for nonexistent metadata

Location:
trunk/gsdl/src/recpt
Files:
3 edited

Legend:

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

    r2504 r2612  
    212212    }// if (err != noError)
    213213
    214   }// if(!args["bft"].empty())
     214  }// end if(!args["bft"].empty())
    215215  else {
    216216    text_tset metadata_items;
     
    221221             response,logout)) return false;
    222222  }
    223  
     223
     224  //get rid of documents that do not have the metadata element classified on
     225  if(!remove_no_meta_results("Title",response, outconvert)) {
     226    return false;
     227    logout<<"ERROR: browseactiontools::remove_no_meta_results failed"<<endl;
     228  }
     229
    224230  textout << outconvert << disp << "_browse:header_\n" <<"_browse:content_";
    225231
  • trunk/gsdl/src/recpt/browseactiontools.cpp

    r2490 r2612  
    5656}
    5757
     58// this stuff is all copied from the queryoptions code - don't ask how it all
     59// hangs in with the filters - those things are a mystery
    5860void set_browsefilter_options(FilterRequest_t &request, text_t &browsestring,
    5961                  cgiargsclass &args)
     
    9496}
    9597
     98bool remove_no_meta_results(text_t metaname, FilterResponse_t &response,
     99                outconvertclass outconvert)
     100{
     101  ResultDocInfo_tarray::iterator check = response.docInfo.begin();
     102  ResultDocInfo_tarray::iterator done = response.docInfo.end();
     103
     104  // look through all the returned documents
     105  while(check != done){
     106    //if the document doesn't have the metadata item classified on
     107    //remove it.
     108    if(*((*check).metadata.find(metaname)->second).values.begin()=="")
     109      {
     110    check = response.docInfo.erase(check);
     111      }
     112    else {
     113       check ++;
     114    }
     115   
     116  }
     117  return true;
     118}
     119
     120
     121
     122
     123
  • trunk/gsdl/src/recpt/browseactiontools.h

    r2466 r2612  
    3434void format_browsestring(text_t orig, text_t& formatted, int and_or);
    3535
     36//this thing sets up the search associated with a browse.  It's programmed by
     37//witchcraft, so I don't really know how/why it works - I lifted the code from
     38//somewhere else.
    3639void set_browsefilter_options(FilterRequest_t &request, text_t &browsestring,
    3740                  cgiargsclass &args);
    3841
    39 void format_browsestring(text_t orig, text_t& formatted, int and_or);
     42//this thing filters out all the results of a request to the collection
     43//(whether it be for all documents or just the ones with specified terms)
     44//that don't have the required "metaname" metadata element.
     45bool remove_no_meta_results(text_t metaname, FilterResponse_t &response,
     46                outconvertclass outconvert);
    4047
    4148#endif
Note: See TracChangeset for help on using the changeset viewer.