Changeset 15836 for gsdl/trunk/src


Ignore:
Timestamp:
2008-05-30T16:00:47+12:00 (16 years ago)
Author:
mdewsnip
Message:

(Adding dynamic classifiers) Not sure if this is necessarily the best place to do this, but added the ability to request the documents from a "get_documents_with_metadata_value()" call to be sorted based on a certain metadata element. Thanks to John Thompson for the SQL statement help.

Location:
gsdl/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/src/colservr/sqlbrowsefilter.cpp

    r15804 r15836  
    160160    text_t metadata_element_name = "";
    161161    text_t metadata_value = "";
     162    text_t sort_by_metadata_element_name = "";
    162163    OptionValue_tarray::const_iterator options_iterator = request.filterOptions.begin();
    163164    while (options_iterator != request.filterOptions.end())
     
    171172    metadata_value = (*options_iterator).value;
    172173      }
     174      if ((*options_iterator).name == "SortByMetadataElement")
     175      {
     176    sort_by_metadata_element_name = (*options_iterator).value;
     177      }
    173178      options_iterator++;
    174179    }
    175180
    176     text_tarray document_OIDs = sql_db_ptr->get_documents_with_metadata_value (metadata_element_name, metadata_value);
     181    text_tarray document_OIDs = sql_db_ptr->get_documents_with_metadata_value (metadata_element_name, metadata_value, sort_by_metadata_element_name);
    177182
    178183    // Fill in response.docInfo with the document OIDs
  • gsdl/trunk/src/protocol/recptprototools.cpp

    r15806 r15836  
    284284
    285285
    286 bool get_documents_with_metadata_value (const text_t metadata_element_name, const text_t metadata_value, 
    287                     const text_t &collection, recptproto *collectproto,
    288                     FilterResponse_t &response, ostream &logout)
     286bool get_documents_with_metadata_value (const text_t metadata_element_name, const text_t metadata_value,
     287                    const text_t sort_by_metadata_element_name, const text_t &collection,
     288                    recptproto *collectproto, FilterResponse_t &response, ostream &logout)
    289289{
    290290  response.clear();
     
    304304  request_option.value = metadata_value;
    305305  request.filterOptions.push_back (request_option);
     306  request_option.name = "SortByMetadataElement";
     307  request_option.value = sort_by_metadata_element_name;
     308  request.filterOptions.push_back (request_option);
    306309
    307310  assert (collectproto != NULL);
  • gsdl/trunk/src/protocol/recptprototools.h

    r15806 r15836  
    7171              recptproto *collectproto, FilterResponse_t &response, ostream &logout);
    7272
    73 bool get_documents_with_metadata_value (const text_t metadata_element_name, const text_t metadata_value, 
    74                     const text_t &collection, recptproto *collectproto,
    75                     FilterResponse_t &response, ostream &logout);
     73bool get_documents_with_metadata_value (const text_t metadata_element_name, const text_t metadata_value,
     74                    const text_t sort_by_metadata_element_name, const text_t &collection,
     75                    recptproto *collectproto, FilterResponse_t &response, ostream &logout);
    7676
    7777#endif
  • gsdl/trunk/src/recpt/dynamicclassifieraction.cpp

    r15834 r15836  
    168168    text_t metadata_value = arg_dcn;
    169169    FilterResponse_t document_OIDs_response;
    170     get_documents_with_metadata_value (metadata_element_name, metadata_value, args["c"], collectproto, document_OIDs_response, logout);
     170    get_documents_with_metadata_value (metadata_element_name, metadata_value, "dls.Title", args["c"], collectproto, document_OIDs_response, logout);
    171171
    172172    // Check the metadata value is valid
Note: See TracChangeset for help on using the changeset viewer.