Skip to content

fix: "Explore courses" search wasn't working with Typesense#267

Merged
feanil merged 4 commits into
masterfrom
braden/fix-typesense-course-explore
May 7, 2026
Merged

fix: "Explore courses" search wasn't working with Typesense#267
feanil merged 4 commits into
masterfrom
braden/fix-typesense-course-explore

Conversation

@bradenmacdonald
Copy link
Copy Markdown
Contributor

@bradenmacdonald bradenmacdonald commented May 5, 2026

Browsing courses at http://apps.local.openedx.io:1998/catalog/courses seems to no longer be working with Typesense. I suspect it was the upgrade to Typesense 2, but it could have been some other change.

The error seen is:

lms-1        | 2026-05-05 00:43:00,335 ERROR 104 [search.views] [user 4] [ip 192.168.65.1] views.py:233 - Search view exception when searching for None for user 4: InvalidParameter('Value None is not a string, integer, or boolean')
lms-1        | Traceback (most recent call last):
lms-1        |   File "/mnt/edx-search/search/views.py", line 201, in _course_discovery
lms-1        |     results = course_discovery_search(
lms-1        |               ^^^^^^^^^^^^^^^^^^^^^^^^
lms-1        |   File "/mnt/edx-search/search/api.py", line 159, in course_discovery_search
lms-1        |     results = searcher.search(
lms-1        |               ^^^^^^^^^^^^^^^^
lms-1        |   File "/mnt/edx-search/search/typesense.py", line 211, in search
lms-1        |     results = self.typesense_index.documents.search(search_args)
lms-1        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lms-1        |   File "/openedx/venv/lib/python3.12/site-packages/typesense/sync/documents.py", line 340, in search
lms-1        |     stringified_search_params = stringify_search_params(search_parameters)
lms-1        |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lms-1        |   File "/openedx/venv/lib/python3.12/site-packages/typesense/preprocess.py", line 144, in stringify_search_params
lms-1        |     raise InvalidParameter(
lms-1        | typesense.exceptions.InvalidParameter: Value None is not a string, integer, or boolean
lms-1        | Internal Server Error: /search/unstable/v0/course_list_search/
lms-1        | 2026-05-05 00:43:00,338 ERROR 104 [django.request] [user None] [ip None] log.py:253 - Internal Server Error: /search/unstable/v0/course_list_search/

This PR applies a quick fix by using "" instead of None when we don't specify any particular search query.

I also updated the README.

Internal ref MNG-4952

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels May 5, 2026
@openedx-webhooks
Copy link
Copy Markdown

Thanks for the pull request, @bradenmacdonald!

This repository is currently maintained by @Ali-Salman29.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Copy link
Copy Markdown
Contributor

@samuelallan72 samuelallan72 left a comment

Choose a reason for hiding this comment

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

@bradenmacdonald 👍

I haven't been able to test this yet, as my devstack is hanging on build... However it's a simple change and it looks solid to me.

Please see my inline comment about the readme update for consideration.

  • I tested this: ...
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

Comment thread README.md Outdated
Comment on lines +25 to +32
If you're using Tutor, the easiest way to use Typesense is to install [tutor-contrib-typesense](https://github.com/open-craft/tutor-contrib-typesense/). To configure it manually, you'll need to update these CMS/LMS settings:

```python
SEARCH_ENGINE = "search.typesense.TypesenseEngine"
FORUM_SEARCH_BACKEND = "forum.search.typesense.TypesenseBackend"
TYPESENSE_URLS = ["http://typesense:8108"]
TYPESENSE_PUBLIC_URL = "http://typesense.example.com:8108"
TYPESENSE_API_KEY: "..."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It might be better to link to the official docs at https://docs.openedx.org/en/latest/site_ops/how-tos/use_typesense_search_backend.html as the source of truth. That doc has a complete explanation of enabling typesense, both with tutor-contrib-typesense and manually. It also has a more detailed listing of manual settings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah, that's much better.

@bradenmacdonald bradenmacdonald force-pushed the braden/fix-typesense-course-explore branch from 87ce001 to c2f9ef9 Compare May 5, 2026 19:57
@bradenmacdonald bradenmacdonald requested a review from feanil May 6, 2026 15:36
@mphilbrick211 mphilbrick211 moved this from Needs Triage to In Eng Review in Contributions May 7, 2026
Copy link
Copy Markdown
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

@bradenmacdonald thanks for the fix. Can you also bump the version for this so we can release it?

@bradenmacdonald
Copy link
Copy Markdown
Contributor Author

@feanil Sure, done.

@feanil feanil merged commit 2723be4 into master May 7, 2026
7 checks passed
@feanil feanil deleted the braden/fix-typesense-course-explore branch May 7, 2026 19:37
@github-project-automation github-project-automation Bot moved this from In Eng Review to Done in Contributions May 7, 2026
@feanil
Copy link
Copy Markdown
Contributor

feanil commented May 7, 2026

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

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants