Ignore:
Timestamp:
2002-02-15T13:51:52+13:00 (22 years ago)
Author:
paradis
Message:

new metadata command [Summary]

File:
1 edited

Legend:

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

    r2706 r2967  
    2727#include "cgiutils.h"
    2828#include "OIDtools.h"
     29#include "summarise.h"
    2930
    3031#include <assert.h>
     
    3940static bool parse_action (text_t::const_iterator &here, const text_t::const_iterator &end,
    4041              format_t *formatlistptr, text_tset &metadata, bool &getParents);
     42
     43text_t format_summary (const text_t& collection, recptproto* collectproto,
     44              ResultDocInfo_t &docinfo, displayclass &disp,
     45              const text_t &text, bool highlight,
     46               ostream& logout);
     47
    4148
    4249void metadata_t::clear() {
     
    530537    formatlistptr->command = comEndHighlight;
    531538
     539  else if (meta == "Summary")
     540    formatlistptr->command = comSummary;
     541
    532542  else {
    533543    formatlistptr->command = comMeta;
     
    959969  case comRel: //if [RelatedDocuments] appears in format string, collect relation data
    960970    return get_related_docs(collection, collectproto, docinfo, logout);
     971  case comSummary:
     972    return format_summary(collection,collectproto,docinfo,disp,text,highlight,logout);
    961973  case comMeta:
    962974
     
    10771089                  text, logout);
    10781090}
     1091
     1092
     1093/* FUNCTION NAME: format_summary
     1094 * DESC: this is invoked when a [Summary] special metadata is processed.
     1095 * RETURNS: a query-biased summary for the document */
     1096
     1097text_t format_summary (const text_t& collection, recptproto* collectproto,
     1098              ResultDocInfo_t &docinfo, displayclass &disp,
     1099              const text_t &text, bool highlight,
     1100              ostream& logout) {
     1101  text_t textToSummarise, query;
     1102  if(text.empty()) { // get document text
     1103      DocumentRequest_t docrequest;
     1104      DocumentResponse_t docresponse;
     1105      comerror_t err;
     1106      docrequest.OID = docinfo.OID;
     1107      collectproto->get_document (collection, docrequest, docresponse, err, logout);
     1108      textToSummarise = docresponse.doc;
     1109  } else // in practice, this would not happen, because text is only
     1110         // loaded with the [Text] command
     1111      textToSummarise = text;
     1112  disp.expandstring("_cgiargq_",query);
     1113  return summarise(textToSummarise,query,80);
     1114}
Note: See TracChangeset for help on using the changeset viewer.