-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix #2553: Change the "index all explorations" job in the admin dashb… #3831
Conversation
…dashboard to an "index all activities" job
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.
Thanks @LanJosh, this is looking good! Just a few notes.
core/domain/collection_services.py
Outdated
def clear_search_index(): | ||
"""Clears the search index. | ||
|
||
WARNING: This runs in-request, and may therefore fail if there are too | ||
many entries in the index. | ||
""" | ||
search_services.clear_index(SEARCH_INDEX_COLLECTIONS) | ||
gae_search_services.clear_index(SEARCH_INDEX_COLLECTIONS) |
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.
Oh, this is interesting. How feasible do you think it would be to move the functions which require gae_search_services to search_services, so that the latter is the only thing interfacing with gae_search_services?
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.
Done.
core/domain/collection_services.py
Outdated
if _should_index(collection) | ||
], SEARCH_INDEX_COLLECTIONS) | ||
collection_summaries = get_collection_summaries_matching_ids(collection_ids) | ||
search_services.index_collection_summaries(collection_summaries) |
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.
Should probably filter the list to remove "None" results, right, since the previous function can return None?
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.
Done.
core/domain/search_services.py
Outdated
|
||
"""Commands for manipulating search rank""" | ||
|
||
from core.platform import models |
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.
Alphabetize.
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.
Done.
core/domain/search_services.py
Outdated
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Commands for manipulating search rank""" |
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.
Add period at end.
This module does more than just manipulate search rank, right?
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.
Done.
Codecov Report
@@ Coverage Diff @@
## develop #3831 +/- ##
========================================
Coverage 46.02% 46.02%
========================================
Files 279 279
Lines 20903 20903
Branches 3278 3278
========================================
Hits 9620 9620
Misses 11283 11283 Continue to review full report at Codecov.
|
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.
Looks good. Just a few more comments.
Also, please reply to each review comments after doing changes. This helps keeping track of which have been addressed. Thanks !
core/controllers/cron.py
Outdated
@@ -96,14 +96,14 @@ def get(self): | |||
job_class.enqueue(job_class.create_new()) | |||
|
|||
|
|||
class CronExplorationSearchRankHandler(base.BaseHandler): | |||
class CronActivitySearchRankHandler(base.BaseHandler): | |||
"""Handler for computing exploration search ranks.""" |
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.
should this be activity here instead of exploration?
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.
Done.
core/domain/activity_jobs_one_off.py
Outdated
@@ -0,0 +1,47 @@ | |||
# coding: utf-8 | |||
# | |||
# Copyright 2014 The Oppia Authors. All Rights Reserved. |
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.
2014 --> 2017
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.
Done.
core/domain/search_services.py
Outdated
@@ -0,0 +1,301 @@ | |||
# coding: utf-8 | |||
# | |||
# Copyright 2014 The Oppia Authors. All Rights Reserved. |
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.
2014 --> 2017
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.
Done.
core/domain/search_services.py
Outdated
be indexed for further queries or not. | ||
|
||
Args: | ||
exp: Exploration. Exploration domain 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.
argument is exp_summary.
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.
Done.
core/domain/search_services.py
Outdated
search queries. | ||
|
||
Args: | ||
exp_summary: ExpSummaryModel. |
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.
Add a brief description of the argument. Look in the function below here.
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.
Done.
core/domain/search_services.py
Outdated
summary object to be converted. | ||
|
||
Returns: | ||
The search dict of the collection domain 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.
Add the type of object returned.
dict. The search dict ...
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.
Done.
core/domain/search_services.py
Outdated
Args: | ||
query_string: str. The query string to search for. | ||
limit: int. The maximum number of results to return. | ||
sort: str. A string indicating how to sort results. This should be a |
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.
str or None
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.
Done.
core/domain/search_services.py
Outdated
|
||
Args: | ||
query_string: str. the query string to search for. | ||
sort: str. This indicates how to sort results. This should be a string |
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.
str or None. Ditto for cursor.
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.
Done.
core/domain/search_services.py
Outdated
name to sort on. When this is None, results are returned based on | ||
their ranking (which is currently set to the same default value | ||
for all collections). | ||
limit: int. the maximum number of results to return. |
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.
Shift it above the sort. Follow the order in arguments.
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.
Done.
core/domain/search_services.py
Outdated
"""Commands for operating on the search status of activities.""" | ||
|
||
from core.platform import models | ||
from core.domain import rights_manager |
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.
Alphabetize.
core.domain should come before core.platform
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.
Done.
Hi @1995YogeshSharma, mind taking another look? |
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.
Just one small change. Otherwise, LGTM!
Thanks!
core/domain/search_services.py
Outdated
@@ -50,7 +50,7 @@ def _exp_summary_to_search_dict(exp_summary): | |||
be indexed for further queries or not. | |||
|
|||
Args: | |||
exp: Exploration. Exploration domain object. | |||
exp: ExpSummaryModel. ExplorationSummary domain 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.
exp --> exp_summary (name of arg)
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.
Done.
Hi @1995YogeshSharma. Can this be merged? |
Yes. I think it's good to go. |
Hi @tjiang11 . I don't think I have merge permissions. Yogesh says its good to go, can you merge this? |
…t-m2 * upstream/develop: (27 commits) Fixes 3687: batch call for exploration and exploration rights object together. (oppia#3815) Fix part oppia#3400 Objective field directive (oppia#3740) Fix oppia#3800 Dropdown menu of the ABOUT in navigation bar (oppia#3855) Fix oppia#3295 Save draft change list to local storage. (oppia#3584) Disable learner dashboard feedback updates send button when no text entered. (oppia#3860) Disable save button while uploading audio to server; add Spanish support to audio languages; add audio loading message to learner view (oppia#3856) Fix oppia#3834: Introduce backend event models to record statistics (oppia#3841) Fix oppia#3852: Fix failing e2e test in develop (oppia#3853) Fix oppia#3826: Move validatorsService from app.js to ValidatorsService.js (oppia#3847) Update the max RAND limit for ID generation to fit within 32 bits. (oppia#3843) Fix oppia#3404: Add default placeholder text for mobile devices (oppia#3845) Fix oppia#2553: Change the "index all explorations" job in the admin dashb… (oppia#3831) Add I18N to give up button; change tooltip text. (oppia#3844) Fix oppia#3721: Update the release_info script to use LCA and the most recent release tag in order to compile the list of changes, rather than relying on git describe. (oppia#3838) show_warning_only_on_button_click (oppia#3833) Deprecate splash page experiment (oppia#3829) Fixes for end to end working between Oppia and Oppia-ml. (oppia#3824) Fix 'Empty path passed in method' error on the collection page. (oppia#3827) Learner dashboard 3.2 (oppia#3759) 📝 Fix oppia#3789 :Space out the profile drop down icons (oppia#3789). (oppia#3817) ...
…oard to an "index all activities" job
#2553