<div dir="ltr">For clarification, do you mean collections in the sense of mongodb collections, or girder collections?  It shouldn't be any problem, for example, searching all items regardless of the parent collection they belong in.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 29, 2017 at 11:27 AM, Zach Mullen <span dir="ltr"><<a href="mailto:zach.mullen@kitware.com" target="_blank">zach.mullen@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">One of the main limitations (or perhaps features?) of mongodb is that a query is applied to only one collection at a time, so your search function would make one query per collection that you wish to search. So, in the case you describe, you'd need to loop over some dynamic set of collections and query each one. Or, create some secondary collection that aggregates all of the data with this metadata field, and contains references to other collections in its documents.<div><br></div><div>Thanks,</div><div><br></div><div>-Zach</div><div><div class="h5"><div class="gmail_extra">
<br><div class="gmail_quote">On Thu, Jun 29, 2017 at 11:22 AM, Andrés Fortier <span dir="ltr"><<a href="mailto:andres@ekumenlabs.com" target="_blank">andres@ekumenlabs.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Zach,<div>thanks for the quick reply. What you say makes as lot of sense, my next question on this was going to be about performance and indexes for this kind of search :). </div><div><br></div><div>Just to clarify, if we go this road, is there a way to query all collections at once or we need to run the query for each collection? I'm asking because we may need to create collections on the fly as the system runs, so it would be great to be able to query all elements regardless of the collection they belong to.</div><div><br></div><div>Thanks again, </div><div>Andy</div></div><div class="m_3551368137405880827HOEnZb"><div class="m_3551368137405880827h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 29, 2017 at 11:48 AM, Zach Mullen <span dir="ltr"><<a href="mailto:zach.mullen@kitware.com" target="_blank">zach.mullen@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Andy,<br><br>Thanks for reaching out! This is actually a common sort of use case, but Girder out-of-the-box does not support it (yet). The main reason for that is because these sorts of queries should typically be performed against a database index so that they can scale up to large numbers of folders/items. So, the recommended route for this case is to create a small plugin that makes sure your desired search field is indexed. To achieve that, you'd add a line like:<br><br><font face="monospace, monospace">    ModelImporter.model('item').en<wbr>sureIndex(['meta.type', {'sparse': True}])</font><br><br>Then, you'd want to probably add a small API endpoint to search by this field, and perhaps even some UI augmentation to expose it somewhere. Let me know if you need help with those other steps.<div><br></div><div>Thanks,<br><br><div>Zach Mullen<br>Kitware, Inc.<br><a href="tel:(919)%20869-8858" value="+19198698858" target="_blank">919-869-8858</a><div><div class="m_3551368137405880827m_1136539944296336620h5"><br><br>On Thu, Jun 29, 2017 at 9:18 AM, Andrés Fortier <<a href="mailto:andres@ekumenlabs.com" target="_blank">andres@ekumenlabs.com</a>> wrote:<br>><br>> Hi all,<br>> first of all, sorry of this is a trivial question, just getting started with Girder. We are currently evaluating using Girder as a backend to store resources (either a folder or a file). One of the requirements we have is that a resource may have 0, 1 or more "types" (although it will most likely be 1 for a starter), which can be plain strings. Also, we want to be able to search resources by type, even if they are in different collections. <br>><br>> Initially we thought on attaching a type property to a resource metadata, which could be an array of strings. However the search bar in the web front-end doesn't seem to support search by metadata, so I was wondering: is metadata search supported on a collection? if yes, how about cross-collection search? If no, should I write a plugin to do that?<br>><br>> Any hints / pointers are much appreciated.<br>><br>> Thanks!<br>> Andy<br>><br></div></div>> ______________________________<wbr>_________________<br>> Girder-users mailing list<br>> <a href="mailto:Girder-users@public.kitware.com" target="_blank">Girder-users@public.kitware.co<wbr>m</a><br>> <a href="http://public.kitware.com/mailman/listinfo/girder-users" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/girder-users</a><br>><br></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></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>