Page 1 of 1

How to specify the scope of search?

PostPosted: Fri Aug 29, 2014 8:54 am
by pz3977
Hi,

I have a question regarding the scope of “Project” and “Dataset”. Does Dataset refer to the file? If I want to search for a metadata inside a file, looking in image and dataset is enough or I should add Project as well?

for i in conn.searchObjects(["Dataset", "Image"], "tiff"):
print i.OMERO_CLASS, i.getName(),i.getDescription(),i.getOwnerFullName(),i.getDate()

Another question is regarding the domain of the search regarding user access level. What kind of access should user have on a file which is being searched? Having read access to a file is enough for search? Is user allowed to download all the search result?

Best regards,
pz3977

Re: How to specify the scope of search?

PostPosted: Fri Aug 29, 2014 1:03 pm
by wmoore
Hi,

Projects and Dataset are simply 'containers' for organising Images. Datasets are not really 'files' - They are just linked to images in the database.

For searching, you should specify the type of object you want to be returned by the search. If you are really looking for images, then you should only use 'Image' in:

Code: Select all
conn.searchObjects(["Image"], "tiff"):


There's no way to use searchObjects() to find Images within a particular Dataset.

If a user has read-access to an Image then they will be able to find that Image via searching. They will then be able to access all the linked data and download the Image.

By default, searchObjects() will search the current group you are logged in to. You can search within specific groups or across all groups as shown in examples:

https://gist.github.com/will-moore/e5fe45145fbfc5494127

Hope that helps,

Will.