-
Notifications
You must be signed in to change notification settings - Fork 143
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
11578 make search-filters request.method agnostic #11582
base: dev/7.6.x
Are you sure you want to change the base?
Conversation
…alls in standard search view, re #11578
This change doesn't seem like it addresses a crashing bug or anything that wasn't already in previous versions of Arches. I could be wrong, but it seems like the target should be 8.0. |
One could argue that issues like #10630 are crashing bugs. Previously, to crash the vanilla map-filter on the frontend you would have had to draw an unrealistic number of vertices. However, given the new "feature by filter" functionality in 7.6.0, you can select an existing geometry that might have a very high vertex-count and this breaks the entire search request as it could exceed the number of characters permitted in the GET header. The vanilla map filter looks like this on the backend: class MapFilter(BaseSearchFilter):
def append_dsl(self, search_query_object, **kwargs):
permitted_nodegroups = kwargs.get("permitted_nodegroups")
include_provisional = kwargs.get("include_provisional")
search_query = Bool()
querystring_params = kwargs.get("querystring", "{}") so it's actually already request-agnostic; a developer could make a search-view that sends a POST request instead of a GET request. The issue is that other filters are hard-coded to expect a GET request, so if those other filters were used in combination with a map-filter POST request, only part of the search request would be fulfilled. Those other search filters are: |
Regarding my comment on PR #10827:
...There's now a solid category of search requests that will always fail whenever a high-vertex feature is used as a map filter. This means that the feature is inherently bugged until the search request can be sent as a POST request rather than GET. |
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.
General comments about structure.
- I think we should push most of the logic to parse the request into the
base_search_view.py
module and centralize it there. - Just like we put the the request object on
self
, we should put thesearch_request
(currently calledsearch_request_object
) onself
as well. - We should then not have to pass it into the methods on the
BaseSearchFilter
Do that first and then I'll re-review.
@@ -132,15 +133,16 @@ def append_dsl(self, search_query_object, **kwargs): | |||
search_query_object["query"].include("map_popup") | |||
search_query_object["query"].include("provisional_resource") | |||
search_query_object["query"].include("permissions") | |||
load_tiles = get_str_kwarg_as_bool("tiles", self.request.GET) | |||
load_tiles = get_str_kwarg_as_bool("tiles", search_request_object) |
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.
for clarity, and to improve on something that should have been done in the first place, this should default to False
and not to search_request_object
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.
This actually already does default to False
, see full method from string_utils.py
:
def get_str_kwarg_as_bool(
key, request_dict: Union[Dict[str, Any], QueryDict], default: bool = False
) -> bool:
value = request_dict.get(key, str(default))
if isinstance(value, bool):
return value
return str_to_bool(str(value))
total = int(self.request.GET.get("total", "0")) | ||
resourceinstanceid = self.request.GET.get("id", None) | ||
search_request_object = kwargs.get("search_request_object", self.request.GET) | ||
for_export = get_str_kwarg_as_bool("export", search_request_object) |
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.
same as above, should default to False
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.
see comment above
✅ (moved it into
✅
✅
|
Types of changes
Description of Change
Issues Solved
Partly addresses #11578
Checklist
Accessibility Checklist
Developer Guide
Ticket Background
Further comments