Skip to content

Implement fields extension #129

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

Merged
merged 18 commits into from
Jan 18, 2023
Merged

Implement fields extension #129

merged 18 commits into from
Jan 18, 2023

Conversation

jonhealy1
Copy link
Collaborator

@jonhealy1 jonhealy1 commented Jan 15, 2023

Related Issue(s):

Description:

Implements the Fields extension for GET and POST Search requests. #127 should be reviewed first.

PR Checklist:

  • Code is formatted and linted (run pre-commit run --all-files)
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable, and docs build successfully (run make docs)
  • Changes are added to the changelog

@jonhealy1 jonhealy1 marked this pull request as draft January 15, 2023 14:13
@jonhealy1 jonhealy1 marked this pull request as ready for review January 15, 2023 15:21
@gadomski
Copy link
Member

Since it looks like this depends on #127, I'm going to wait on reviewing this PR until #127 is merged.

Copy link
Member

@gadomski gadomski left a comment

Choose a reason for hiding this comment

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

I don't know enough about the elasticsearch side to feel comfortable fully reviewing this -- @philvarner do you have bandwidth to take a look as well?

@jonhealy1
Copy link
Collaborator Author

I don't know enough about the elasticsearch side to feel comfortable fully reviewing this -- @philvarner do you have bandwidth to take a look as well?

@gadomski @philvarner The Fields extension code has been copy/ pasted from stac-fastapi-sqlalchemy along with some of the tests. The logic itself doesn't use Elasticsearch. The filtering is done after the results are retrieved from Elasticsearch.

Comment on lines +346 to +347
k if k in Settings.get().indexed_fields else f"properties.{k}"
for k in search_request.query.keys()
Copy link
Member

Choose a reason for hiding this comment

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

One thing to be aware of here if you plan on eventually supporting Python 3.11 -- Python 3.11 changes the default __str__ implementation for enums, so you may have to define it yourself. See stac-utils/stac-fastapi@c32d5bc#diff-7e6336bc2ad3ff7b065d2980d4d70fb1e5292b8748be4b8ce65d1c61425a7ab8R69-R77 for an example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good to know. Maybe now is the time to update

@jonhealy1 jonhealy1 merged commit 0f75c89 into main Jan 18, 2023
@gadomski gadomski deleted the implement-fields-extension branch January 18, 2023 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants