Skip to content

docs(example): set up GitHub filters example with Algolia#814

Merged
sarahdayan merged 6 commits intonextfrom
docs/github-filters-algolia
Nov 15, 2021
Merged

docs(example): set up GitHub filters example with Algolia#814
sarahdayan merged 6 commits intonextfrom
docs/github-filters-algolia

Conversation

@sarahdayan
Copy link
Copy Markdown
Member

@sarahdayan sarahdayan commented Nov 11, 2021

This swaps the static sources for repositories, authors and organizations with Algolia indices. This allows us to leverage Algolia features (full-text search, highlighting, custom ranking, search for facet values, etc.).

When a tag is selected, it's removed from the available filters to avoid adding the same tag twice and polluting the results.

Sans.titre.mov

The indices are static extracts from the GitHub public API, indexed in Algolia. They contain a list of public repos from Algolia and CodeSandbox, along with public members of both organizations.

sandbox

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci bot commented Nov 11, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 19523b2:

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-playground Configuration
@algolia/autocomplete-example-preview-panel-in-modal Configuration
@algolia/autocomplete-example-react-renderer Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-starter Configuration
@algolia/autocomplete-example-reshape Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-github-notification-filters PR

Copy link
Copy Markdown
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

works nicely! slightly confusing there's no submit override but it just refreshes

showPrefixesSource && prefixesSource,
showPostfixesSource && postfixesSource,
].filter(Boolean);
].filter(Boolean) as Array<AutocompleteSource<AutocompleteItem>>;
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.

why is the cast needed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not every source returns items that exactly satisfy the AutocompleteItem contract (sometimes there's more data, sometimes there's less), but there's enough overlap so that it doesn't matter, and each source has its own template anyway.

I think I can improve types in a separate PR since this is only a demo.

Co-authored-by: Haroen Viaene <hello@haroen.me>
@sarahdayan sarahdayan merged commit f22696b into next Nov 15, 2021
@sarahdayan sarahdayan deleted the docs/github-filters-algolia branch November 15, 2021 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants