Changeset 15804

Show
Ignore:
Timestamp:
29.05.2008 16:21:08 (11 years ago)
Author:
mdewsnip
Message:

(Adding dynamic classifiers) Adding support for the new "GetDocumentsWithMetadataValue?" request.

Files:
1 modified

Legend:

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

    r15802 r15804  
    155155  } 
    156156 
     157  // Request for the documents with a certain metadata value assigned 
     158  else if (request.requestParams == "GetDocumentsWithMetadataValue") 
     159  { 
     160    text_t metadata_element_name = ""; 
     161    text_t metadata_value = ""; 
     162    OptionValue_tarray::const_iterator options_iterator = request.filterOptions.begin(); 
     163    while (options_iterator != request.filterOptions.end()) 
     164    { 
     165      if ((*options_iterator).name == "MetadataElement") 
     166      { 
     167    metadata_element_name = (*options_iterator).value; 
     168      } 
     169      if ((*options_iterator).name == "MetadataValue") 
     170      { 
     171    metadata_value = (*options_iterator).value; 
     172      } 
     173      options_iterator++; 
     174    } 
     175 
     176    text_tarray document_OIDs = sql_db_ptr->get_documents_with_metadata_value (metadata_element_name, metadata_value); 
     177 
     178    // Fill in response.docInfo with the document OIDs 
     179    text_tarray::iterator document_OID_iterator = document_OIDs.begin(); 
     180    while (document_OID_iterator != document_OIDs.end()) 
     181    { 
     182      ResultDocInfo_t document_result_doc; 
     183      document_result_doc.OID = *document_OID_iterator; 
     184      response.docInfo.push_back (document_result_doc); 
     185      document_OID_iterator++; 
     186    } 
     187  } 
     188 
    157189  sql_db_ptr->closedatabase();  // Important that local library doesn't leave any files open 
    158190}