Changeset 16061


Ignore:
Timestamp:
2008-06-18T20:00:43+12:00 (16 years ago)
Author:
mdewsnip
Message:

(Adding dynamic classifiers) Lots of changes to support the grouping nodes properly.

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

Legend:

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

    r16059 r16061  
    164164    selected_grouping_node_OID = output_grouping_nodes (classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
    165165  }
    166 
    167   // Prepare to output the classifier (and maybe document) nodes
    168   text_t classifier_node_OID = args["dcn"];
     166  text_t classifier_node_OID = args["dcn"];  // args["dcn"] may have been modified by output_grouping_nodes()
    169167  int classifier_node_indent = 0;
    170168
    171169  // Simple case at the top level: just output the child classifier nodes
    172   if (args["dcn"] == selected_grouping_node_OID)
    173   {
    174     text_t metadata_value_filter = args["dcn"] + "*";
    175     output_child_classifier_nodes (classifier_node_OID, metadata_value_filter, classifier_node_indent, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
     170  if (classifier_node_OID == selected_grouping_node_OID)
     171  {
     172    text_t metadata_value_filter = selected_grouping_node_OID + "*";
     173    output_child_classifier_nodes (classifier_node_OID, "", metadata_value_filter, classifier_node_indent, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
    176174  }
    177175
     
    179177  else
    180178  {
    181     // Output the parent classifier nodes
    182     output_parent_classifier_nodes (classifier_node_OID, classifier_node_indent, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
    183 
    184     // Display the selected classifier node
    185     text_tarray classifier_node_labels;
    186     splitchar(classifier_node_OID.begin(), classifier_node_OID.end(), '|', classifier_node_labels);
    187     text_t classifier_node_label = classifier_node_labels.back();
    188     text_t classifier_node_numleafdocs = "?";
    189     display_classifier_node (classifier_node_OID, classifier_node_label, classifier_node_numleafdocs, classifier_node_indent, args, collectproto, browsers, disp, outconvert, textout, logout);
    190     classifier_node_indent++;
     179    // This is the classifier node OID without any grouping information
     180    text_t classifier_node_OID_sans_grouping = classifier_node_OID;
     181    if (starts_with (classifier_node_OID, selected_grouping_node_OID + "|"))
     182    {
     183      classifier_node_OID_sans_grouping = substr (classifier_node_OID.begin() + (selected_grouping_node_OID + "|").size(), classifier_node_OID.end());
     184    }
     185
     186    // Determine the parent classifier node labels
     187    text_tlist parent_classifier_node_labels;
     188    splitchar(classifier_node_OID_sans_grouping.begin(), classifier_node_OID_sans_grouping.end(), '|', parent_classifier_node_labels);
     189
     190    // Output the parent classifier nodes and the current classifier node
     191    output_upper_classifier_nodes (selected_grouping_node_OID, parent_classifier_node_labels, classifier_node_indent, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
    191192
    192193    // Output the child classifier nodes
    193     text_t metadata_value_filter = args["dcn"] + "|*";
    194     output_child_classifier_nodes (classifier_node_OID, metadata_value_filter, classifier_node_indent, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
     194    text_t classifier_node_metadata_value = classifier_node_OID_sans_grouping;
     195    text_t metadata_value_filter = classifier_node_OID_sans_grouping + "|*";
     196    output_child_classifier_nodes (classifier_node_OID, classifier_node_metadata_value, metadata_value_filter, classifier_node_indent, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
    195197
    196198    // Get the document nodes at this level
    197199    text_t metadata_element_name = classifier_options["metadata_element_name"];
    198     text_t classifier_node_metadata_value = args["dcn"];
    199200    text_t sort_documents_by = classifier_options["-sort_documents_by"];
    200201    FilterResponse_t documents_response;
     
    285286  {
    286287    // Is this the grouping node that is currently selected?
    287     if ((*grouping_node_iterator).OID == args["dcn"])
     288    if (starts_with (args["dcn"], (*grouping_node_iterator).OID))
    288289    {
    289290      selected_grouping_node_OID = (*grouping_node_iterator).OID;
     
    320321
    321322
    322 void dynamicclassifieraction::output_parent_classifier_nodes (text_t classifier_node_OID,
    323                                       int& classifier_node_indent,
    324                                   text_tmap classifier_options, cgiargsclass &args,
    325                                   recptproto *collectproto, browsermapclass *browsers,
    326                                   displayclass &disp, outconvertclass &outconvert,
    327                                   ostream &textout, ostream &logout)
    328 {
    329   // Determine the parent classifier nodes
    330   text_tarray parent_classifier_node_labels;
    331   splitchar(classifier_node_OID.begin(), classifier_node_OID.end(), '|', parent_classifier_node_labels);
    332   parent_classifier_node_labels.pop_back();
    333 
     323void dynamicclassifieraction::output_upper_classifier_nodes (text_t root_classifier_node_OID,
     324                                 text_tlist parent_classifier_node_labels,
     325                                 int& classifier_node_indent,
     326                                 text_tmap classifier_options, cgiargsclass &args,
     327                                 recptproto *collectproto, browsermapclass *browsers,
     328                                 displayclass &disp, outconvertclass &outconvert,
     329                                 ostream &textout, ostream &logout)
     330{
    334331  // Display the parent classifier nodes
    335   text_t parent_classifier_node_OID = "";
    336   text_tarray::iterator parent_classifier_node_labels_iterator = parent_classifier_node_labels.begin();
     332  text_t parent_classifier_node_OID = root_classifier_node_OID;
     333  text_tlist::iterator parent_classifier_node_labels_iterator = parent_classifier_node_labels.begin();
    337334  while (parent_classifier_node_labels_iterator != parent_classifier_node_labels.end())
    338335  {
     
    350347
    351348void dynamicclassifieraction::output_child_classifier_nodes (text_t classifier_node_OID,
     349                                 text_t classifier_node_metadata_value,
    352350                                 text_t metadata_value_filter,
    353351                                 int& classifier_node_indent,
     
    371369  // After processing any hierarchical metadata values we're left with the child classifer nodes
    372370  map<text_t, int, lttext_t> child_classifier_nodes;
    373   text_t current_position = args["dcn"];
    374371  ResultDocInfo_tarray::iterator metadata_value_iterator = metadata_values_response.docInfo.begin();
    375372  while (metadata_value_iterator != metadata_values_response.docInfo.end())
    376373  {
    377374    text_t metadata_value = (*metadata_value_iterator).OID;
     375    // logout << "Metadata value: " << metadata_value << ", current position: " << current_position << endl;
    378376
    379377    // If we're not at the top-level we need to remove the current position from the metadata values
    380     if (current_position != "" && starts_with(metadata_value, current_position + "|"))
    381     {
    382       metadata_value = substr(metadata_value.begin() + (current_position + "|").size(), metadata_value.end());
     378    if (starts_with(metadata_value, classifier_node_metadata_value + "|"))
     379    {
     380      metadata_value = substr(metadata_value.begin() + (classifier_node_metadata_value + "|").size(), metadata_value.end());
    383381    }
    384382
  • gsdl/trunk/src/recpt/dynamicclassifieraction.h

    r16058 r16061  
    7070                ostream &textout, ostream &logout);
    7171
    72   void output_parent_classifier_nodes (text_t classifier_node_OID,
    73                        int& classifier_node_indent,
    74                        text_tmap classifier_options, cgiargsclass &args,
    75                        recptproto *collectproto, browsermapclass *browsers,
    76                        displayclass &disp, outconvertclass &outconvert,
    77                        ostream &textout, ostream &logout);
     72  void output_upper_classifier_nodes (text_t root_classifier_node_OID,
     73                      text_tlist parent_classifier_node_labels,
     74                      int& classifier_node_indent,
     75                      text_tmap classifier_options, cgiargsclass &args,
     76                      recptproto *collectproto, browsermapclass *browsers,
     77                      displayclass &disp, outconvertclass &outconvert,
     78                      ostream &textout, ostream &logout);
    7879
    7980  void output_child_classifier_nodes (text_t classifier_node_OID,
     81                      text_t classifier_node_metadata_value,
    8082                      text_t metadata_value_filter,
    8183                      int& classifier_node_indent,
Note: See TracChangeset for help on using the changeset viewer.