-
Notifications
You must be signed in to change notification settings - Fork 13
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
use a stable sort by default for all queries for Items #52
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
25ebdc4
improve elasticsearch mappings
philvarner a4992a4
remove black
philvarner 2cef400
apply mappings, fix type problem with transactions methods
philvarner f63db85
add creating collection
philvarner 317a99c
revert mappings back to original ones
philvarner 26b06ad
Add better elasticsearch mappings
philvarner dbfa9c1
Merge branch 'main' into pv/update-es-mappings
philvarner 889cb8b
add CHANGELOG
philvarner e29b500
update PR template
philvarner 807bcf2
remove string match type on proj_centroid and proj_geometry
philvarner 49da01f
Merge branch 'main' into pv/default-to-stable-sort
philvarner 80f9586
change default sort from none to the stable sorting of properties.dat…
philvarner fa342be
add changelog
philvarner 1e1d95d
Merge branch 'main' into pv/default-to-stable-sort
philvarner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
"""Item crud client.""" | ||
import json | ||
import logging | ||
from datetime import datetime | ||
from datetime import datetime as datetime_type | ||
from typing import List, Optional, Type, Union | ||
from urllib.parse import urljoin | ||
|
||
|
@@ -147,15 +147,16 @@ def get_item(self, item_id: str, collection_id: str, **kwargs) -> Item: | |
) | ||
return self.item_serializer.db_to_stac(item["_source"], base_url) | ||
|
||
def _return_date(self, datetime): | ||
datetime = datetime.split("/") | ||
if len(datetime) == 1: | ||
datetime = datetime[0][0:19] + "Z" | ||
@staticmethod | ||
def _return_date(interval_str): | ||
intervals = interval_str.split("/") | ||
if len(intervals) == 1: | ||
datetime = intervals[0][0:19] + "Z" | ||
return {"eq": datetime} | ||
else: | ||
start_date = datetime[0] | ||
end_date = datetime[1] | ||
if ".." not in datetime: | ||
start_date = intervals[0] | ||
end_date = intervals[1] | ||
if ".." not in intervals: | ||
start_date = start_date[0:19] + "Z" | ||
end_date = end_date[0:19] + "Z" | ||
elif start_date != "..": | ||
|
@@ -175,7 +176,7 @@ def get_search( | |
collections: Optional[List[str]] = None, | ||
ids: Optional[List[str]] = None, | ||
bbox: Optional[List[NumType]] = None, | ||
datetime: Optional[Union[str, datetime]] = None, | ||
datetime: Optional[Union[str, datetime_type]] = None, | ||
limit: Optional[int] = 10, | ||
query: Optional[str] = None, | ||
token: Optional[str] = None, | ||
|
@@ -238,7 +239,16 @@ def post_search( | |
) -> ItemCollection: | ||
"""POST search catalog.""" | ||
base_url = str(kwargs["request"].base_url) | ||
search = Search(using=self.client, index="stac_items") | ||
search = ( | ||
Search() | ||
.using(self.client) | ||
.index("stac_items") | ||
.sort( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. applies a sort now. |
||
{"properties.datetime": {"order": "desc"}}, | ||
{"id": {"order": "desc"}}, | ||
{"collection": {"order": "desc"}}, | ||
) | ||
) | ||
|
||
if search_request.query: | ||
if type(search_request.query) == str: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes a warning about variables shadowing outer scope