Skip to content

WIP: Introduce typesense search #7877

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

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

mickmister
Copy link
Contributor

Summary

This PR adds additional search functionality from https://typesense.org. It enables real-time searching, fuzzy searching, and typo tolerance.

Info on how we plan to weight and customize filtering of the content will be posted here soon.

Ticket Link

@mattermost-build
Copy link
Contributor

Hello @mickmister,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@cwarnermm cwarnermm added the preview-environment Allow the preview environment to be generated for Pull Requests coming from fork repositories label Apr 11, 2025
Copy link

Newest code from mickmister has been published to preview environment for Git SHA d94cc17

@cwarnermm cwarnermm added preview-environment Allow the preview environment to be generated for Pull Requests coming from fork repositories and removed preview-environment Allow the preview environment to be generated for Pull Requests coming from fork repositories labels Apr 11, 2025
Copy link

Newest code from mickmister has been published to preview environment for Git SHA 1d0d954

@cwarnermm cwarnermm added preview-environment Allow the preview environment to be generated for Pull Requests coming from fork repositories and removed preview-environment Allow the preview environment to be generated for Pull Requests coming from fork repositories labels Apr 15, 2025
Copy link

Newest code from mickmister has been published to preview environment for Git SHA 3f69c85

Comment on lines 1 to 15
TYPESENSE_HOST="${TYPESENSE_HOST:-http://localhost:8108}"
TYPESENSE_API_KEY="${TYPESENSE_API_KEY:-test_api_key}"

curl "${TYPESENSE_HOST}/collections" \
-X POST \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-d '{
"name": "mm_product_docs",
"fields": [
{"name": "category", "type": "string" },
{"name": "weight", "type": "int32" }
],
"default_sorting_field": "weight"
}'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how we can prepare the collection to know about how we want to organize certain filterable fields. At the moment, running this script is optional as the scraper will auto generate a collection, but running this is necessary for the field customizations we want to add

Comment on lines +7 to +26
"start_urls": [
{
"url": "http://localhost:8000",
"tags": []
}
],
"sitemap_urls": [
"http://localhost:8000/sitemap.xml"
],
"selectors": {
"default": {
"lvl0": "article h1",
"lvl1": "article h2",
"lvl2": "article h3",
"lvl3": "article h4",
"lvl4": "article h5",
"lvl5": "article h6",
"text": "article p, article li"
}
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can add selectors for config settings, and section off user/admin docs. Below is an example from docsearch docs for sectioning off different content
https://docsearch.algolia.com/docs/legacy/config-file/#selectors_key-tailor-your-selectors

{
  "start_urls": [
    {
      "url": "http://www.example.com/docs/faq/",
      "selectors_key": "faq"
    },
    {
      "url": "http://www.example.com/docs/"
    }
  ],
  "selectors": {
    "default": {
      "lvl0": ".docs h1",
      "lvl1": ".docs h2",
      "lvl2": ".docs h3",
      "lvl3": ".docs h4",
      "lvl4": ".docs h5",
      "text": ".docs p, .docs li"
    },
    "faq": {
      "lvl0": ".faq h1",
      "lvl1": ".faq h2",
      "lvl2": ".faq h3",
      "lvl3": ".faq h4",
      "lvl4": ".faq h5",
      "text": ".faq p, .faq li"
    }
  }
}

@@ -4072,7 +4072,8 @@ def setup(_: Sphinx):
html_css_files = [
"css/mattermost-global.css",
"css/homepage-v1.css",
"css/compass-icons.css"
"css/compass-icons.css",
"https://cdn.jsdelivr.net/npm/typesense-docsearch-css@0.3.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably want to bundle this, instead of serve from cdn, to be consistent with existing assets

@cwarnermm cwarnermm added preview-environment Allow the preview environment to be generated for Pull Requests coming from fork repositories and removed preview-environment Allow the preview environment to be generated for Pull Requests coming from fork repositories labels Apr 15, 2025
Copy link

Newest code from mickmister has been published to preview environment for Git SHA d89d1f0

@cwarnermm cwarnermm added preview-environment Allow the preview environment to be generated for Pull Requests coming from fork repositories and removed preview-environment Allow the preview environment to be generated for Pull Requests coming from fork repositories labels Apr 16, 2025
Copy link

Newest code from mickmister has been published to preview environment for Git SHA 6dad451

@mattermost-build
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contributor Lifecycle/1:stale preview-environment Allow the preview environment to be generated for Pull Requests coming from fork repositories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants