Changeset 16115
- Timestamp:
- 2008-06-24T13:31:08+12:00 (15 years ago)
- Location:
- gsdl/trunk/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/src/recpt/dynamicclassifieraction.cpp
r16114 r16115 181 181 if (!classifier_options["-group_using"].empty()) 182 182 { 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 184 185 classifier_node_OID = args["dcn"]; // args["dcn"] may have been modified by output_grouping_nodes() 185 186 } … … 192 193 text_t classifier_node_metadata_value = selected_grouping_node_OID; 193 194 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); 195 196 classifier_node_OID = args["dcn"]; // args["dcn"] may have been modified by output_hlist_classifier_nodes() 196 197 } … … 291 292 292 293 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" value299 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 infodbtype305 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 returned312 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 node318 if (args["dcn"] == "")319 {320 args["dcn"] = grouping_nodes_response.docInfo.front().OID;321 }322 323 // Add the necessary metadata to the grouping nodes324 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 correctly335 (*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 requests338 (*grouping_node_iterator).metadata["Title"].values.push_back ((*grouping_node_iterator).OID);339 grouping_node_iterator++;340 }341 342 // Display the grouping nodes343 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 349 294 text_t dynamicclassifieraction::output_hlist_classifier_nodes (text_t parent_classifier_node_OID, 350 text_t classifier_node_metadata_value,351 295 text_t metadata_value_filter, 296 text_t metadata_value_grouping_expression, 352 297 text_tmap classifier_options, cgiargsclass &args, 353 298 recptproto *collectproto, browsermapclass *browsers, … … 358 303 text_t metadata_element_name = classifier_options["metadata_element_name"]; 359 304 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); 361 306 362 307 // If the request failed then it's probably because the collection isn't using an SQL infodbtype … … 379 324 { 380 325 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 values383 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 }387 326 388 327 // Is this metadata value hierarchical? -
gsdl/trunk/src/recpt/dynamicclassifieraction.h
r16114 r16115 65 65 text_tmap parse_classifier_options (text_t classifier_specification, cgiargsclass &args); 66 66 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 72 67 text_t output_hlist_classifier_nodes (text_t parent_classifier_node_OID, 73 text_t classifier_node_metadata_value,74 68 text_t metadata_value_filter, 69 text_t metadata_value_grouping_expression, 75 70 text_tmap classifier_options, cgiargsclass &args, 76 71 recptproto *collectproto, browsermapclass *browsers,
Note:
See TracChangeset
for help on using the changeset viewer.