Changeset 2967


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

new metadata command [Summary]

Location:
trunk/gsdl/src/recpt
Files:
2 added
3 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}
  • trunk/gsdl/src/recpt/formattools.h

    r2706 r2967  
    3434
    3535enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon,
    36         comDoc, comHighlight, comEndHighlight, comRel, comHref};
     36        comDoc, comHighlight, comEndHighlight, comRel, comHref, comSummary};
    3737enum pcommand_t {pNone, pImmediate, pTop, pAll};
    3838enum dcommand_t {dMeta, dText};
  • trunk/gsdl/src/recpt/win32.mak

    r2501 r2967  
    7979        datelistbrowserclass.h invbrowserclass.h pagedbrowserclass.h \
    8080        htmlbrowserclass.h historydb.h phindbrowserclass.h collectoraction.h \
    81         nullproto.h argdb.h browseaction.h browseactiontools.h phindaction.h
     81        nullproto.h argdb.h browseaction.h browseactiontools.h phindaction.h \
     82        summarise.h
    8283
    8384CGIHEADERS = cgiwrapper.h
     
    9596        invbrowserclass.cpp pagedbrowserclass.cpp htmlbrowserclass.cpp \
    9697        historydb.cpp phindbrowserclass.cpp collectoraction.cpp nullproto.cpp \
    97         argdb.cpp browseaction.cpp browseactiontools.cpp phindaction.cpp
     98        argdb.cpp browseaction.cpp browseactiontools.cpp phindaction.cpp \
     99        summarise.cpp
    98100
    99101CGISOURCES = librarymain.cpp cgiwrapper.cpp
     
    111113        invbrowserclass.obj pagedbrowserclass.obj htmlbrowserclass.obj \
    112114        historydb.obj phindbrowserclass.obj collectoraction.obj nullproto.obj \
    113         argdb.obj browseaction.obj browseactiontools.obj phindaction.obj
     115        argdb.obj browseaction.obj browseactiontools.obj phindaction.obj \
     116        summarise.obj
    114117
    115118CGIOBJECTS = librarymain.obj cgiwrapper.obj
Note: See TracChangeset for help on using the changeset viewer.