-
Notifications
You must be signed in to change notification settings - Fork 599
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
base: master
Are you sure you want to change the base?
Conversation
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. |
Newest code from mickmister has been published to preview environment for Git SHA d94cc17 |
… introduce-typesense
… introduce-typesense
Newest code from mickmister has been published to preview environment for Git SHA 1d0d954 |
Newest code from mickmister has been published to preview environment for Git SHA 3f69c85 |
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" | ||
}' |
There was a problem hiding this comment.
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
"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" | ||
} | ||
}, |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
Newest code from mickmister has been published to preview environment for Git SHA d89d1f0 |
Newest code from mickmister has been published to preview environment for Git SHA 6dad451 |
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
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