diff --git a/.coveragerc b/.coveragerc old mode 100755 new mode 100644 diff --git a/codecov.yml b/codecov.yml old mode 100755 new mode 100644 diff --git a/openedx.yaml b/openedx.yaml old mode 100755 new mode 100644 diff --git a/search/api.py b/search/api.py index 935c3471..7aefee69 100755 --- a/search/api.py +++ b/search/api.py @@ -260,6 +260,8 @@ def course_discovery_search(search_term=None, size=20, from_=0, field_dictionary if getattr(settings, 'ALLOW_CATALOG_VISIBILITY_FILTER', False): use_field_dictionary['catalog_visibility'] = CATALOG_VISIBILITY_CATALOG_AND_ABOUT + hashtag_query_list = kwargs.get('hashtag_query_list', []) + results = searcher.search( query_string=search_term, doc_type="course_info", @@ -271,6 +273,7 @@ def course_discovery_search(search_term=None, size=20, from_=0, field_dictionary filter_dictionary=filter_dictionary, exclude_dictionary=exclude_dictionary, facet_terms=course_discovery_facets(), + hashtag_query_list=hashtag_query_list, sort=sort_args ) diff --git a/search/elastic.py b/search/elastic.py index f9fc8cdc..3914ec1a 100755 --- a/search/elastic.py +++ b/search/elastic.py @@ -522,6 +522,7 @@ def search(self, exclude_ids=None, use_field_match=False, include_content=False, + hashtag_query_list=None, **kwargs): # pylint: disable=too-many-arguments, too-many-locals, too-many-branches, arguments-differ """ Implements call to search the index for the desired content. @@ -640,6 +641,11 @@ def search(self, "analyzer": "standard" } }) + elastic_queries.append({ + "terms": { + "course_hashtag_list": hashtag_query_list + } + }) if field_dictionary: if use_field_match: @@ -667,7 +673,7 @@ def search(self, if elastic_queries: query_segment = { "bool": { - "must": elastic_queries + "should": elastic_queries } } diff --git a/search/views.py b/search/views.py index 752011be..cbbdb0de 100755 --- a/search/views.py +++ b/search/views.py @@ -207,6 +207,8 @@ def course_discovery(request): status_code = 500 search_term = request.POST.get("search_string", None) + hashtag_query_list_string = request.POST.get("hashtag_query_list_string", '') + hashtag_query_list = hashtag_query_list_string.split(', ') try: size, from_, page = _process_pagination_values(request) @@ -227,6 +229,7 @@ def course_discovery(request): size=size, from_=from_, field_dictionary=field_dictionary, + hashtag_query_list=hashtag_query_list, user=request.user, allow_enrollment_end_filter=True, sort_type=request.POST.get('sort_type', '') diff --git a/setup.py b/setup.py index a6231747..dbed2bd5 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='edx-search', - version='1.2.3', + version='1.1.0', description='Search and index routines for index access', author='edX', author_email='oscm@edx.org', diff --git a/test_requirements.txt b/test_requirements.txt old mode 100755 new mode 100644 index 2f19ebd6..baf449b8 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,12 +1,12 @@ -e . coverage==4.0.3 -ddt -edx-lint==0.5.5 +edx-lint==0.4.0 mock==1.3.0 pep8==1.6.2 pytz codecov tox>=2.3.1,<3.0.0 + # edX libraries -e git+https://github.com/edx/event-tracking.git@0.1.0#egg=event-tracking diff --git a/tox.ini b/tox.ini old mode 100755 new mode 100644