-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
feat(search): add runtime support for DocSearch v4 #11327
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
Merged
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
2d1d9c9
feat(search): update Docsearch to v4-beta
dylantientcheu a990dfd
fix: update search docs
dylantientcheu 9a72c17
fix: checks
dylantientcheu 4752b94
fix: replace search by, by powered by
dylantientcheu 0233bda
fix(askai): add facet filters
dylantientcheu 8766d31
Merge branch 'main' into algolia/docsearch-v4
dylantientcheu e771fb1
fix: factor out string typecheck
dylantientcheu 53ff498
Merge branch 'algolia/docsearch-v4' of https://github.com/dylantientc…
dylantientcheu 4fed7f0
fix: based on comments
dylantientcheu b7c60c5
fixup: resolve comments
dylantientcheu 6b2aa00
fix: version range
dylantientcheu 4c407ca
fix AskAI spelling in comments
slorber 5c53a49
fix little hydration mismatch due to CSS optimizations
slorber e00b8c9
various type improvements
slorber 769413d
improve config validation
slorber 8714e68
upgrade algolia packages
slorber 8bf3581
restore AskAI feature until PR ready
slorber 1e9a895
docs
slorber 5f4ef65
docs
slorber fd71b7a
remove useless optional types for translations
slorber ec4c09a
restore former translation key order to easy code review
slorber b0d6b10
add useful v4 upgrade TODO
slorber ae20d65
add missing translations + upgrade base locale file
slorber f2f6c07
lint fix
slorber d827805
simplify code and types
slorber 7552028
improve config validation + add proper input type
slorber 54a1263
Add facetFilters validation logic + fallback
slorber 9a8a8c0
damn, forgot about contextualSearch...
slorber 6ec5aff
Merge branch 'main' into algolia/docsearch-v4
slorber 0bade16
extract mergeFacetFilters utils
slorber 7404454
fix type of useAlgoliaContextualFacetFilters
slorber 6ab1a5f
add unit tests for mergeFacetFilters
slorber abedf6b
implement applyAskAiContextualSearch
slorber 25d3327
fix attr
slorber 9679da8
fix type
slorber 2687d6b
add todo
slorber 30678fd
improve v3 TS retro-compatibility
slorber 98d9b14
lint issue
slorber ea81dec
restore DocSearch v4
slorber 9b49752
improve Algolia accepted themeConfig typing + type tests
slorber d42b7c6
remove useless ESLint todos?
slorber 8cebd98
remove useless navbarSearchContainer vertical padding: item is alread…
slorber 4a1bbd5
remove useless css
slorber 0382b6f
add useful comment
slorber c0bca41
revert props spread behavior change
slorber c1c03b5
upgrade to DocSearch v4 GA
slorber b6521ea
Merge branch 'main' into algolia/docsearch-v4
slorber b82fa25
upgrade Zod to fix website typechecking issue
slorber b3ce80b
try to fix TS skipLibCheck=false problem for TS 5.1 CI
slorber 1e1053b
try to fix DocSearch problem with TS 5.1 CI checks
slorber 1d23aee
empty
slorber 3920ce1
Upgrade to 4.0.1
slorber f56e21c
Merge branch 'main' into algolia/docsearch-v4
slorber f2895d6
try to fix CI issue
slorber cb60bab
try to fix CI issue
slorber 8957643
try to fix the CI issues
slorber 9efee55
revert to DocSearch v3 by default (for now)
slorber 8fe7dfc
lockfile
slorber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/docusaurus-theme-search-algolia/src/__tests__/utils.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| import {mergeFacetFilters} from '../client/utils'; | ||
|
|
||
| describe('mergeFacetFilters', () => { | ||
| it('merges [string,string]', () => { | ||
| expect(mergeFacetFilters('f1', 'f2')).toEqual(['f1', 'f2']); | ||
| }); | ||
|
|
||
| it('merges [string,array]', () => { | ||
| // TODO this looks wrong to me, should be ['f1', ['f2', 'f3']] ? | ||
| expect(mergeFacetFilters('f1', ['f2', 'f3'])).toEqual(['f1', 'f2', 'f3']); | ||
| }); | ||
|
|
||
| it('merges [string,undefined]', () => { | ||
| expect(mergeFacetFilters('f1', undefined)).toEqual('f1'); | ||
| }); | ||
|
|
||
| it('merges [undefined,string]', () => { | ||
| expect(mergeFacetFilters(undefined, 'f1')).toEqual('f1'); | ||
| }); | ||
|
|
||
| it('merges [array,undefined]', () => { | ||
| expect(mergeFacetFilters(['f1', 'f2'], undefined)).toEqual(['f1', 'f2']); | ||
| }); | ||
|
|
||
| it('merges [undefined,array]', () => { | ||
| expect(mergeFacetFilters(undefined, ['f1', 'f2'])).toEqual(['f1', 'f2']); | ||
| }); | ||
|
|
||
| it('merges [array,array]', () => { | ||
| expect(mergeFacetFilters(['f1'], ['f2'])).toEqual(['f1', 'f2']); | ||
|
|
||
| // TODO this looks wrong to me, should be [['f1', 'f2'], ['f3', 'f4']] ? | ||
slorber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| expect(mergeFacetFilters(['f1', 'f2'], ['f3', 'f4'])).toEqual([ | ||
| 'f1', | ||
| 'f2', | ||
| 'f3', | ||
| 'f4', | ||
| ]); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.