Skip to content

Search error when SEARCH_SKIP_ENROLLMENT_START_DATE_FILTERING is set to False #211

Description

@arsentur

Description:
When LMS settings has SEARCH_SKIP_ENROLLMENT_START_DATE_FILTERING = False the search returns 500 error. Error on the screenshot below:
Image

Release: Teak

Logs:

Traceback (most recent call last):
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/_httprequests.py", line 145, in __validate
    request.raise_for_status()
  File "/openedx/venv/lib/python3.11/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://meilisearch:7700/indexes/tutor_course_info/search

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/openedx/venv/lib/python3.11/site-packages/search/views.py", line 184, in course_discovery
    results = course_discovery_search(
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/search/api.py", line 148, in course_discovery_search
    results = searcher.search(
              ^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/search/meilisearch.py", line 180, in search
    meilisearch_results = self.meilisearch_index.search(query_string, opt_params)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/errors.py", line 75, in wrapper
    raise exc
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/errors.py", line 72, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/index.py", line 302, in search
    return self.http.post(
           ^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/_httprequests.py", line 97, in post
    return self.send_request(requests.post, path, body, content_type, serializer=serializer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/_httprequests.py", line 77, in send_request
    return self.__validate(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/meilisearch/_httprequests.py", line 148, in __validate
    raise MeilisearchApiError(str(err), request) from err
meilisearch.errors.MeilisearchApiError: MeilisearchApiError. Error code: invalid_search_filter. Error message: Attribute `enrollment_start` is not filterable. Available filterable attributes are: `language org modes enrollment_end catalog_visibility`.
1:17 enrollment_start <= 1751537192.036342. Hint: It might not be working because you're not up to date with the Meilisearch version that search call requires. Error documentation: https://docs.meilisearch.com/errors#invalid_search_filter Error type: invalid_request
2025-07-03 10:06:32,058 ERROR 22 [django.request] [user None] [ip None] log.py:241 - Internal Server Error: /search/course_discovery/

STR:

  1. Add to LMS production settings - SEARCH_SKIP_ENROLLMENT_START_DATE_FILTERING = False
  2. Go to <LMS_URL>/courses
  3. Try to search courses

AR:
500 Error in networks

ER:
Search functionality works

Tech assumptions:
Following the migration from Elasticsearch to MeiliSearch, the set of filterable attributes has become static and hardcoded.
As a result, enabling default Open edX behavior that extends search filters (e.g., using enrollment_start) can cause MeiliSearch to reject the query, leading to a server error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions