Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoped object search #373

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Scoped object search #373

wants to merge 3 commits into from

Conversation

jsh2134
Copy link
Contributor

@jsh2134 jsh2134 commented Oct 20, 2020

Search from within the folders/files/dataset shortcuts in the same way as Object.search, but scope it to the shortcut in both location and object type

The following searches can be replaced with one nice command

folder.search("foobar AND type:file", parent_object_id=folder.id)
folder.search("foobar", object_type="file", parent_object_id=folder.id)
folder.files(query="foobar")

become

folder.files("foobar")

# TODO
params['ancestor_id'] = self.id
params['limit'] = 1000
return super(Object, self).search(query, **params)
Copy link
Contributor Author

@jsh2134 jsh2134 Dec 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I left this TODO in here in order to determine if there should be a recursive option. Should the user be able to get anything in this folder, or just depth=0 objects.

and/or ancestor_id needs to be replaced by parent_object_id (although the server may handle this)

This PR needs tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets keep it ancestor_id so that it is recursive. Users can pass depth=0 if they want, and we will document this.

@davecap davecap marked this pull request as draft January 8, 2021 14:59
return self.objects(query=query, **params)

def search(self, query='', **params):
query = query or params.pop('query', '')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary

# TODO
params['ancestor_id'] = self.id
params['limit'] = 1000
return super(Object, self).search(query, **params)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object.search(), super not necessary because search is a classmethod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants