Skip to content
Snippets Groups Projects
Commit ed9085c8 authored by Jay Rainey's avatar Jay Rainey
Browse files

Added usage to CatalogSearch. Refs #9585.

parent fe516c95
No related branches found
No related tags found
No related merge requests found
......@@ -60,16 +60,14 @@ namespace Mantid
~CatalogSearch() {}
/// Algorithm's name for identification overriding a virtual method
virtual const std::string name() const { return "CatalogSearch"; }
///Summary of algorithms purpose
virtual const std::string summary() const {return "Searches investigations in the catalog using the properties set.";}
///Summary of algorithms purpose
virtual const std::string summary() const { return "Searches all active catalogs using the provided input parameters."; }
/// Algorithm's version for identification overriding a virtual method
virtual int version() const { return 1; }
/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const { return "DataHandling\\Catalog"; }
private:
/// Overwrites Algorithm init method.
void init();
/// Overwrites Algorithm exec method
......
......@@ -33,7 +33,7 @@ namespace Mantid
declareProperty("StartDate","", isDate, "The start date for the range of investigations to be searched. The format must be DD/MM/YYYY.");
declareProperty("EndDate","", isDate, "The end date for the range of investigations to be searched. The format must be DD/MM/YYYY.");
declareProperty("Keywords","","A comma separated list of words to search for in the investigation.");
declareProperty("InvestigationId","","The ID of the investigation. Also known as: ");
declareProperty("InvestigationId","","The ID of the investigation.");
declareProperty("InvestigatorSurname", "", "The surname of the investigator associated to the investigation.");
declareProperty("SampleName", "", "The name of the sample used in the investigation.");
declareProperty("DataFileName","", "The name of the data file in the investigation.");
......
......@@ -9,7 +9,58 @@
Description
-----------
This algorithm searches for the investigations and stores the search
results in a table workspace.
This algorithm searches through the all active catalogs for investigations based on the parameters set, and saves the results into a workspace.
Usage
-----
**Example - searches for investigations in the catalog based on parameters set.**
.. code:: python
# When logging into the catalog the session class is returned.
# This can then be used throughout to perform other ICAT routines.
search_results = CatalogSearch(Instrument="ALF",limit=3)
# A tuple is returned from CatalogSearch(). The first item is the search results.
investigations = search_results[0]
print "The number of investigations returned was: " + str(len(investigations))
# Print the title of all returned investigations.
for investigation in investigations:
print "The title of the investigation is: " + investigation['Title']
# Log out of the catalog, otherwise results are appended to the workspace (search_results).
CatalogLogout()
Output:
.. code:: python
The number of investigations returned was: 3
The title of the investigation is: CAL_ALF_14/02/2014 15:37:05
The title of the investigation is: CAL_ALF_18/11/2013 15:03:48
The title of the investigation is: CAL_ALF_19/11/2013 11:59:56
**Example - paging results returned.**
.. code:: python
# When CountOnly is set to True a separate COUNT query is performed to see the total
# number of investigations that will be returned by this search. This is used for paging functionality.
# If CountOnly is not provided, then ALL results are returned. This can be extremely slow.
search_results = CatalogSearch(Instrument="ALF",CountOnly=True,StartDate="03/06/2012", EndDate="03/06/2014")
print "The number of search results returned was: " + str(search_results[1])
CatalogLogout()
Output:
.. code:: python
The number of search results returned was: 109
.. categories::
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment