-
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
Open
whatisgalen
wants to merge
10
commits into
dev/7.6.x
Choose a base branch
from
11578_search_req_method
base: dev/7.6.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+48
−31
Open
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c4023c1
use search_request query obj in lieu of request.GET for all methods c…
whatisgalen 0315aac
use kwargs.search_request_object instead of request.GET in search_fil…
whatisgalen 6599a43
handle case in tests of empty dict value for paging-filter search par…
whatisgalen 30e3dac
Merge branch 'archesproject-dev/7.6.x' into 11578_search_req_method
whatisgalen fa81b4f
set dynamic requestMethod for search query method on frontend, re #11578
whatisgalen a1f34c4
search_request_object --> SearchView.search_request; set self.search_…
whatisgalen e68f68b
move self.search_request into BaseSearchFilter via SearchFilterFactor…
whatisgalen 9f46aa9
rm search_request as kwarg given self has it now, re #11578
whatisgalen 9abbbba
resolve race conditions between searchfilter factory and searchview, …
whatisgalen 3efea56
rm redundant assignment, re #11578
whatisgalen 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
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 |
---|---|---|
|
@@ -122,6 +122,7 @@ | |
class StandardSearchView(BaseSearchView): | ||
|
||
def append_dsl(self, search_query_object, **kwargs): | ||
search_request_object = kwargs.get("search_request_object", self.request.GET) | ||
search_query_object["query"].include("graph_id") | ||
search_query_object["query"].include("root_ontology_class") | ||
search_query_object["query"].include("resourceinstanceid") | ||
|
@@ -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) | ||
if load_tiles: | ||
search_query_object["query"].include("tiles") | ||
|
||
def execute_query(self, search_query_object, response_object, **kwargs): | ||
for_export = get_str_kwarg_as_bool("export", self.request.GET) | ||
pages = self.request.GET.get("pages", None) | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. same as above, should default to 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. see comment above |
||
pages = search_request_object.get("pages", None) | ||
total = int(search_request_object.get("total", "0")) | ||
resourceinstanceid = search_request_object.get("id", None) | ||
dsl = search_query_object["query"] | ||
if for_export or pages: | ||
results = dsl.search(index=RESOURCES_INDEX, scroll="1m") | ||
|
@@ -220,6 +222,7 @@ def handle_search_results_query( | |
permitted_nodegroups=permitted_nodegroups, | ||
include_provisional=include_provisional, | ||
querystring=querystring, | ||
search_request_object=sorted_query_obj, | ||
) | ||
append_instance_permission_filter_dsl(self.request, search_query_object) | ||
except Exception as err: | ||
|
@@ -235,7 +238,11 @@ def handle_search_results_query( | |
for filter_type, querystring in list(sorted_query_obj.items()): | ||
search_filter = search_filter_factory.get_filter(filter_type) | ||
if search_filter: | ||
search_filter.execute_query(search_query_object, response_object) | ||
search_filter.execute_query( | ||
search_query_object, | ||
response_object, | ||
search_request_object=sorted_query_obj, | ||
) | ||
|
||
if response_object["results"] is not None: | ||
# allow filters to modify the results | ||
|
@@ -246,6 +253,7 @@ def handle_search_results_query( | |
search_query_object, | ||
response_object, | ||
permitted_nodegroups=permitted_nodegroups, | ||
search_request_object=sorted_query_obj, | ||
) | ||
|
||
search_query_object.pop("query") | ||
|
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
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.
for clarity, and to improve on something that should have been done in the first place, this should default to
False
and not tosearch_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 fromstring_utils.py
: