Changeset 16115

Show
Ignore:
Timestamp:
24.06.2008 13:31:08 (12 years ago)
Author:
mdewsnip
Message:

Now uses output_hlist_classifier_nodes() instead of output_grouping_nodes().

Location:
gsdl/trunk/src/recpt
Files:
2 modified

Legend:

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

    r16114 r16115  
    181181  if (!classifier_options["-group_using"].empty()) 
    182182  { 
    183     selected_grouping_node_OID = output_grouping_nodes (classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout); 
     183    selected_grouping_node_OID = output_hlist_classifier_nodes ("", "", classifier_options["-group_using"], classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout); 
     184 
    184185    classifier_node_OID = args["dcn"];  // args["dcn"] may have been modified by output_grouping_nodes() 
    185186  } 
     
    192193    text_t classifier_node_metadata_value = selected_grouping_node_OID; 
    193194    text_t metadata_value_filter = selected_grouping_node_OID + "*"; 
    194     selected_hlist_node_OID = output_hlist_classifier_nodes (parent_classifier_node_OID, classifier_node_metadata_value, metadata_value_filter, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout); 
     195    selected_hlist_node_OID = output_hlist_classifier_nodes (parent_classifier_node_OID, metadata_value_filter, "", classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout); 
    195196    classifier_node_OID = args["dcn"];  // args["dcn"] may have been modified by output_hlist_classifier_nodes() 
    196197  } 
     
    291292 
    292293 
    293 text_t dynamicclassifieraction::output_grouping_nodes (text_tmap classifier_options, cgiargsclass &args, 
    294                                recptproto *collectproto, browsermapclass *browsers, 
    295                                displayclass &disp, outconvertclass &outconvert, 
    296                                ostream &textout, ostream &logout) 
    297 { 
    298   // Get all the metadata values for the specified element, and group them according to the "-group_using" value 
    299   text_t metadata_element_name = classifier_options["metadata_element_name"]; 
    300   text_t metadata_value_grouping_expression = classifier_options["-group_using"]; 
    301   FilterResponse_t grouping_nodes_response; 
    302   bool request_success = get_metadata_values (metadata_element_name, "", metadata_value_grouping_expression, args["c"], collectproto, grouping_nodes_response, logout); 
    303  
    304   // If the request failed then it's probably because the collection isn't using an SQL infodbtype 
    305   if (request_success == false) 
    306   { 
    307     textout << outconvert << disp << "Error: Dynamic classifier functionality is not available. Please check you are using an SQL infodbtype and the collection has been rebuilt.\n"; 
    308     return ""; 
    309   } 
    310  
    311   // Check some grouping nodes were returned 
    312   if (grouping_nodes_response.docInfo.empty()) 
    313   { 
    314     return ""; 
    315   } 
    316  
    317   // If no classifier node has been specified automatically go to the first grouping node 
    318   if (args["dcn"] == "") 
    319   { 
    320     args["dcn"] = grouping_nodes_response.docInfo.front().OID; 
    321   } 
    322  
    323   // Add the necessary metadata to the grouping nodes 
    324   text_t selected_grouping_node_OID = ""; 
    325   ResultDocInfo_tarray::iterator grouping_node_iterator = grouping_nodes_response.docInfo.begin(); 
    326   while (grouping_node_iterator != grouping_nodes_response.docInfo.end()) 
    327   { 
    328     // Is this the grouping node that is currently selected? 
    329     if (starts_with (args["dcn"], (*grouping_node_iterator).OID)) 
    330     { 
    331       selected_grouping_node_OID = (*grouping_node_iterator).OID; 
    332     } 
    333  
    334     // Add the necessary metadata required to display the grouping nodes correctly 
    335     (*grouping_node_iterator).metadata["doctype"].values.push_back ("classify"); 
    336     (*grouping_node_iterator).metadata["haschildren"].values.push_back ("1"); 
    337     (*grouping_node_iterator).metadata["numleafdocs"].values.push_back ("?");  // We can't determine this without more database requests 
    338     (*grouping_node_iterator).metadata["Title"].values.push_back ((*grouping_node_iterator).OID); 
    339     grouping_node_iterator++; 
    340   } 
    341  
    342   // Display the grouping nodes 
    343   display_classifier_nodes (grouping_nodes_response, "HList", 0, args, collectproto, browsers, disp, outconvert, textout, logout); 
    344  
    345   return selected_grouping_node_OID; 
    346 } 
    347  
    348  
    349294text_t dynamicclassifieraction::output_hlist_classifier_nodes (text_t parent_classifier_node_OID, 
    350                                    text_t classifier_node_metadata_value, 
    351295                                   text_t metadata_value_filter, 
     296                                   text_t metadata_value_grouping_expression, 
    352297                                   text_tmap classifier_options, cgiargsclass &args, 
    353298                                   recptproto *collectproto, browsermapclass *browsers, 
     
    358303  text_t metadata_element_name = classifier_options["metadata_element_name"]; 
    359304  FilterResponse_t metadata_values_response; 
    360   bool request_success = get_metadata_values (metadata_element_name, metadata_value_filter, "", args["c"], collectproto, metadata_values_response, logout); 
     305  bool request_success = get_metadata_values (metadata_element_name, metadata_value_filter, metadata_value_grouping_expression, args["c"], collectproto, metadata_values_response, logout); 
    361306 
    362307  // If the request failed then it's probably because the collection isn't using an SQL infodbtype 
     
    379324  { 
    380325    text_t metadata_value = (*metadata_value_iterator).OID; 
    381  
    382     // If we're not at the top-level we need to remove the current position from the metadata values 
    383     if (starts_with(metadata_value, classifier_node_metadata_value + "|")) 
    384     { 
    385       metadata_value = substr(metadata_value.begin() + (classifier_node_metadata_value + "|").size(), metadata_value.end()); 
    386     } 
    387326 
    388327    // Is this metadata value hierarchical? 
  • gsdl/trunk/src/recpt/dynamicclassifieraction.h

    r16114 r16115  
    6565  text_tmap parse_classifier_options (text_t classifier_specification, cgiargsclass &args); 
    6666 
    67   text_t output_grouping_nodes (text_tmap classifier_options, cgiargsclass &args, 
    68                 recptproto *collectproto, browsermapclass *browsers, 
    69                 displayclass &disp, outconvertclass &outconvert, 
    70                 ostream &textout, ostream &logout); 
    71  
    7267  text_t output_hlist_classifier_nodes (text_t parent_classifier_node_OID, 
    73                     text_t classifier_node_metadata_value, 
    7468                    text_t metadata_value_filter, 
     69                    text_t metadata_value_grouping_expression, 
    7570                    text_tmap classifier_options, cgiargsclass &args, 
    7671                    recptproto *collectproto, browsermapclass *browsers,