Skip to content
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

Merged
merged 5 commits into from
Sep 5, 2017

Conversation

LanJosh
Copy link
Contributor

@LanJosh LanJosh commented Aug 30, 2017

…oard to an "index all activities" job

#2553

…dashboard to an "index all activities" job
Copy link
Member

@seanlip seanlip left a 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.

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)
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

if _should_index(collection)
], SEARCH_INDEX_COLLECTIONS)
collection_summaries = get_collection_summaries_matching_ids(collection_ids)
search_services.index_collection_summaries(collection_summaries)
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


"""Commands for manipulating search rank"""

from core.platform import models
Copy link
Member

Choose a reason for hiding this comment

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

Alphabetize.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

# See the License for the specific language governing permissions and
# limitations under the License.

"""Commands for manipulating search rank"""
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@codecov-io
Copy link

codecov-io commented Aug 30, 2017

Codecov Report

Merging #3831 into develop will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98a592b...b6da70c. Read the comment docs.

Copy link
Contributor

@1995YogeshSharma 1995YogeshSharma left a 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 !

@@ -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."""
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -0,0 +1,47 @@
# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

2014 --> 2017

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -0,0 +1,301 @@
# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

2014 --> 2017

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

be indexed for further queries or not.

Args:
exp: Exploration. Exploration domain object.
Copy link
Contributor

Choose a reason for hiding this comment

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

argument is exp_summary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

search queries.

Args:
exp_summary: ExpSummaryModel.
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

summary object to be converted.

Returns:
The search dict of the collection domain object.
Copy link
Contributor

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 ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

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
Copy link
Contributor

Choose a reason for hiding this comment

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

str or None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


Args:
query_string: str. the query string to search for.
sort: str. This indicates how to sort results. This should be a string
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

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.
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

"""Commands for operating on the search status of activities."""

from core.platform import models
from core.domain import rights_manager
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@LanJosh
Copy link
Contributor Author

LanJosh commented Aug 31, 2017

Hi @1995YogeshSharma, mind taking another look?

Copy link
Contributor

@1995YogeshSharma 1995YogeshSharma left a 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!

@@ -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.
Copy link
Contributor

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@pranavsid98
Copy link
Contributor

Hi @1995YogeshSharma. Can this be merged?

@1995YogeshSharma
Copy link
Contributor

Yes. I think it's good to go.

@pranavsid98
Copy link
Contributor

Hi @tjiang11 . I don't think I have merge permissions. Yogesh says its good to go, can you merge this?

@tjiang11 tjiang11 merged commit dd4d7c3 into oppia:develop Sep 5, 2017
giritheja added a commit to giritheja/oppia that referenced this pull request Sep 17, 2017
…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)
  ...
@LanJosh LanJosh deleted the index-all-activities-job branch September 18, 2017 19:07
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.

6 participants