\(\renewcommand\AA{\unicode{x212B}}\)

CatalogSearch v1

../_images/CatalogSearch-v1_dlg.png

CatalogSearch dialog.

Summary

Searches all active catalogs using the provided input parameters.

See Also

CatalogMyDataSearch, CatalogGetDataFiles, CatalogLogin, CatalogPublish

Properties

Name

Direction

Type

Default

Description

InvestigationName

Input

string

The name of the investigation to search for.

Instrument

Input

string

The name of the instrument used in the investigation.

RunRange

Input

string

The range of runs to search for related investigations. Must be in the format 0000-0000 or 0000:0000.

StartDate

Input

string

The start date for the range of investigations to be searched. The format must be DD/MM/YYYY.

EndDate

Input

string

The end date for the range of investigations to be searched. The format must be DD/MM/YYYY.

Keywords

Input

string

A comma separated list of words to search for in the investigation.

InvestigationId

Input

string

The ID of the investigation.

InvestigatorSurname

Input

string

The surname of the investigator associated to the investigation.

SampleName

Input

string

The name of the sample used in the investigation.

DataFileName

Input

string

The name of the data file in the investigation.

InvestigationType

Input

string

The type of the investigation.

MyData

Input

boolean

False

If set to true, only search in investigations of which you are an investigator, e.g. ‘My Data’.

CountOnly

Input

boolean

False

Boolean option to perform COUNT search only. This is used for paging.

Limit

Input

number

100

The maximum amount of search results to return. Adds a LIMIT clause to the query. This is used for paging.

Offset

Input

number

0

The location to begin returning results from. This is used for paging.

Session

Input

string

The session information of the catalog search in.

OutputWorkspace

Output

TableWorkspace

Mandatory

The name of the workspace that will be created to store the search results.

NumberOfSearchResults

Output

number

The number of search results returned for the INPUT. Performs a COUNT query to determine this. This is used for paging.

Description

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.

# 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: {}".format(len(investigations)))

# Print the title of all returned investigations.
for investigation in investigations:
        print("The title of the investigation is: {}".format(investigation['Title']))

# Log out of the catalog, otherwise results are appended to the workspace (search_results).
CatalogLogout()

Output:

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.

# 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: {}".format(search_results[1]))

CatalogLogout()

Output:

The number of search results returned was: 109

Categories: AlgorithmIndex | DataHandling\Catalog

Source

C++ header: CatalogSearch.h

C++ source: CatalogSearch.cpp