Changeset 15834

Show
Ignore:
Timestamp:
30.05.2008 14:31:36 (12 years ago)
Author:
mdewsnip
Message:

(Adding dynamic classifiers) Now displays the parent classifier node as well as the documents.

Files:
1 modified

Legend:

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

    r15807 r15834  
    111111  if (arg_dcl.empty()) 
    112112  { 
    113     textout << outconvert << disp << "Error: Missing \"dcl\" value.\n"; 
     113    textout << outconvert << disp << "Error: Missing dcl argument.\n"; 
    114114    textout << outconvert << disp << "_document:footer_\n"; 
    115115    return true; 
     
    120120  if (cinfo->dynamic_classifiers.find(arg_dcl) == cinfo->dynamic_classifiers.end()) 
    121121  { 
    122     textout << outconvert << disp << "Error: Invalid \"dcl\" value " << arg_dcl << ".\n"; 
     122    textout << outconvert << disp << "Error: Invalid dcl value \"" << arg_dcl << "\".\n"; 
    123123    textout << outconvert << disp << "_document:footer_\n"; 
    124124    return true; 
     
    170170    get_documents_with_metadata_value (metadata_element_name, metadata_value, args["c"], collectproto, document_OIDs_response, logout); 
    171171 
     172    // Check the metadata value is valid 
     173    if (document_OIDs_response.docInfo.empty()) 
     174    { 
     175      textout << outconvert << disp << "Error: No documents have metadata value \"" << arg_dcn << "\".\n"; 
     176      textout << outconvert << disp << "_document:footer_\n"; 
     177      return true; 
     178    } 
     179 
    172180    // Make an array of matching document OIDs 
    173181    text_tarray document_OIDs; 
     
    179187    } 
    180188 
    181     // Request the necessary metadata for these documents 
     189    // Display the classifier node 
     190    ResultDocInfo_t classifier_node; 
     191    classifier_node.OID = arg_dcn; 
     192    classifier_node.metadata["doctype"].values.push_back("classify"); 
     193    classifier_node.metadata["haschildren"].values.push_back("1"); 
     194    classifier_node.metadata["numleafdocs"].values.push_back(document_OIDs.size()); 
     195    classifier_node.metadata["Title"].values.push_back(classifier_node.OID); 
     196    bptr->output_section_group (classifier_node, args, args["c"], 0, formatlistptr, use_table, metadata, getParents, collectproto, disp, outconvert, textout, logout); 
     197 
     198    // Request the necessary metadata for the documents under this node 
    182199    FilterResponse_t document_info_response; 
    183200    get_info (document_OIDs, args["c"], args["l"], metadata, getParents, collectproto, document_info_response, logout); 
    184201 
    185202    // Display the document nodes 
    186     bptr->output_section_group (document_info_response, args, args["c"], 0, formatlistptr, use_table, metadata, getParents, collectproto, disp, outconvert, textout, logout); 
     203    bptr->output_section_group (document_info_response, args, args["c"], 1, formatlistptr, use_table, metadata, getParents, collectproto, disp, outconvert, textout, logout); 
    187204  } 
    188205