<div dir="ltr">Hi Brian,<div><br></div><div>Items actually keep track of what top-level resource they live under in their model data. This isn't exposed via the core web API, so you'd want to expose it via a plugin that would create a new endpoint. You could do this (mostly) in the database, by using find() with a query like the following:</div><div><br></div><div><font face="monospace, monospace">results = self.model('item').find({</font></div><div><font face="monospace, monospace"> 'name': {'$regex': searchRegex},</font></div><div><font face="monospace, monospace"> 'baseParentType': 'collection',</font></div><div><font face="monospace, monospace"> 'baseParentId': collectionId</font></div><div><font face="monospace, monospace">})</font></div><div><font face="monospace, monospace">return list(self.model('item').filterResultsByPermission(results, self.getCurrentUser(), level=AccessType.READ, limit=limit, offset=offset))</font></div><div><br></div><div><br></div><div>It would probably also be a good idea to add the relevant indexes to the item collection to make such searching much faster.</div><div><br></div><div><br></div><div>HTH,</div><div><br></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Zach Mullen<br>Kitware, Inc.<br>919-869-8858</div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Apr 13, 2017 at 1:45 PM, Brian E Chapman <span dir="ltr"><<a href="mailto:Brian.Chapman@utah.edu" target="_blank">Brian.Chapman@utah.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
Hi Everyone,
<div><br>
</div>
<div>I’m interested using the Python API to find all the items in a collection that match a name pattern. I’ve written a recursive function that goes through the items and folders (using the client listItem and listFolder methods) in the collection
but it seems incredibly slow and I’m assuming there must be a better way of doing it. I’m using girder_client vs 2.0.0</div>
<div><br>
</div>
<div><br>
<div><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">Brian
E Chapman, Ph.D</span><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">Associate
Professor</span><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">Department
of Radiology and Imaging</span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none"> </span><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">Sciences</span><br style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">University
of Utah</span> </div>
<br>
</div>
</div>
<br>______________________________<wbr>_________________<br>
Girder-users mailing list<br>
<a href="mailto:Girder-users@public.kitware.com">Girder-users@public.kitware.<wbr>com</a><br>
<a href="http://public.kitware.com/mailman/listinfo/girder-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/girder-users</a><br>
<br></blockquote></div><br></div>