Define constraints to make a complex search on the database.
A search manager is avalaible as an Interface attribute. Its main usage is simply to be called to create a Search object which will be responsible for specifying the returned data and for submitting the actual query.
Some additional methods are provided to list, retrieve and delete saved search.
>>> query = [ ('xnat:subjectData/SUBJECT_ID', 'LIKE', '%'),
('xnat:projectData/ID', '=', 'my_project'),
[ ('xnat:subjectData/AGE', '>', '14'),
'AND'
],
'OR'
]
>>> search = interface.search('my_search', query)
>>>
>>> # no search is saved because it was not submitted
>>> interface.search.saved()
[]
>>> # submit and get results
>>> search.get_subjects()
[...]
>>> # now the search is saved
>>> interface.search.saved()
['my_search']
>>>
>>> same_search = interface.search.get('my_search')