-
Notifications
You must be signed in to change notification settings - Fork 165
Add section-based search filtering #1758
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
4 commits
Select commit
Hold shift + click to select a range
d9b54f5
Add section-based search filtering for DocSearch
fdevans 158a94f
Fix filter injection into Algolia requests
fdevans f778c67
Fix Copilot feedback issues and organize internal documentation
fdevans 5a41226
Fix click race condition in filter toggle button
fdevans 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # DocSearch Filters Integration | ||
|
|
||
| This guide explains how to integrate the section filtering component into your Rundeck documentation search. | ||
|
|
||
| ## Components Created | ||
|
|
||
| ### 1. DocSearchFilters.vue | ||
| - Location: `docs/.vuepress/components/DocSearchFilters.vue` | ||
| - A Vue component that provides a filter button with a dropdown panel | ||
| - Shows section checkboxes (Learning, User Guide, API, Administration, Developer, Release Notes, General) | ||
| - Persists filter selections in localStorage | ||
| - Dispatches custom events when filters change | ||
|
|
||
| ### 2. docsearch-filters.ts Plugin | ||
| - Location: `docs/.vuepress/plugins/docsearch-filters.ts` | ||
| - Client-side plugin that integrates filters with DocSearch | ||
| - Listens for filter update events and applies them to DocSearch | ||
| - Monitors DocSearch modal for filter restoration | ||
|
|
||
| ### 3. Client Configuration Updates | ||
| - Updated `docs/.vuepress/client.ts` to initialize the filter integration | ||
| - Imports and calls `initializeDocSearchFilters()` on app startup | ||
|
|
||
| ## Integration in Layout | ||
|
|
||
| The filter button is **automatically injected** into the navbar by the client configuration. No manual component placement is needed. | ||
|
|
||
| The `injectDocSearchFiltersIntoNavbar()` function in `client.ts` automatically: | ||
| 1. Waits for the DocSearch container to be rendered | ||
| 2. Creates a wrapper element next to the search container | ||
| 3. Mounts the `DocSearchFilters` component dynamically | ||
|
|
||
| This ensures the filter component appears right next to the search button without requiring manual template modifications. | ||
|
|
||
| ## How It Works | ||
|
|
||
| 1. **User clicks the filter button** (funnel icon with badge) | ||
| 2. **Filter dropdown opens** showing available section tags | ||
| 3. **User selects/deselects sections** via checkboxes | ||
| 4. **Selections are stored** in localStorage for persistence | ||
| 5. **Filter state is dispatched** via custom `docsearch-filters-updated` event | ||
| 6. **Plugin intercepts Algolia requests** - The `docsearch-filters.ts` plugin patches `fetch` and `XMLHttpRequest` to intercept all Algolia API calls | ||
| 7. **Facet filters are injected** - Selected sections are added to the request's `facetFilters` parameter as OR conditions (e.g., `tags:Learning OR tags:API`) | ||
| 8. **Results are filtered by Algolia** - Algolia returns only results matching the selected section tags | ||
| 9. **Search input is triggered** - An input event is dispatched to refresh the search results with the new filters applied | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Available Sections | ||
| The component currently supports these sections (from `config.json` tags): | ||
| - Learning | ||
| - User Guide | ||
| - API | ||
| - Administration | ||
| - Developer | ||
| - Release Notes | ||
| - General | ||
|
|
||
| To add new sections: | ||
| 1. Update `.docsearch/config.json` to add new `start_urls` with tags | ||
| 2. Update the `sections` array in `DocSearchFilters.vue` | ||
|
|
||
| ### VuePress Configuration | ||
| The DocSearch configuration in `docs/.vuepress/config.ts` includes: | ||
| ```typescript | ||
| searchParameters: { | ||
| hitsPerPage: 100, | ||
| facetFilters: [`version:${setup.base}`], | ||
| facets: ['tags'] | ||
| } | ||
| ``` | ||
|
|
||
| The `facets: ['tags']` tells Algolia to include tags as filterable attributes. | ||
|
|
||
| ## Styling | ||
|
|
||
| The component uses VuePress theme variables for styling: | ||
| - `--c-brand` - Brand color | ||
| - `--c-border` - Border color | ||
| - `--c-text-secondary` - Secondary text color | ||
| - `--c-bg`, `--c-bg-light` - Background colors | ||
|
|
||
| It automatically adapts to dark mode using `html.dark` selector. | ||
|
|
||
| ## Testing | ||
|
|
||
| To test the filters: | ||
|
|
||
| 1. Build/run the docs: `npm run docs:dev` | ||
| 2. Click the filter button in the navbar | ||
| 3. Select a section (e.g., "Learning") | ||
| 4. Perform a search | ||
| 5. Results should only show items tagged with the selected section | ||
| 6. Refresh the page - filter selections persist via localStorage | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Filters not appearing in results | ||
| - Ensure Algolia index has been re-scraped with new tags | ||
| - Check that `facets: ['tags']` is in the config | ||
| - Verify the section tags match what's in `config.json` | ||
|
|
||
| ### localStorage not working | ||
| - Browser privacy mode disables localStorage | ||
| - Clear localStorage and refresh if there are issues | ||
|
|
||
| ### Component not visible | ||
| - Ensure DocSearchFilters component is imported and placed in the layout | ||
| - Check browser console for Vue component registration errors |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Developer Documentation | ||
|
|
||
| This directory contains internal documentation for developers working on the Rundeck documentation project. These guides cover build processes, automation scripts, and architectural decisions. | ||
|
|
||
| ## Contents | ||
|
|
||
| ### 📋 [PR-FEED-README.md](./PR-FEED-README.md) | ||
| **SaaS Development Feed Generator** | ||
|
|
||
| Comprehensive guide for generating RSS/Atom feeds and markdown pages from recently merged pull requests in Rundeck repositories. This script is run as part of the SaaS release process to communicate updates deployed to Runbook Automation SaaS. | ||
|
|
||
| **Key Topics:** | ||
| - Weekly SaaS release workflow | ||
| - Tag-based PR comparison | ||
| - Configuration management | ||
| - Feed generation (RSS 2.0 and Atom 1.0) | ||
| - Integration with release notes process | ||
|
|
||
| **Usage:** `npm run pr-feed` | ||
|
|
||
| --- | ||
|
|
||
| ### 🔍 [DOCSEARCH_FILTERS_README.md](./DOCSEARCH_FILTERS_README.md) | ||
| **DocSearch Section Filters Integration** | ||
|
|
||
| Technical documentation for the custom DocSearch filter component that allows users to filter documentation search results by section (Learning, API, Administration, etc.). | ||
|
|
||
| **Key Topics:** | ||
| - Component architecture (Vue + VuePress) | ||
| - Client-side plugin integration | ||
| - Algolia request interception | ||
| - LocalStorage persistence | ||
| - Automatic navbar injection | ||
|
|
||
| **Files Covered:** | ||
| - `docs/.vuepress/components/DocSearchFilters.vue` | ||
| - `docs/.vuepress/plugins/docsearch-filters.ts` | ||
| - `docs/.vuepress/client.ts` | ||
|
|
||
| --- | ||
|
|
||
| ## Related Documentation | ||
|
|
||
| ### Main Project Documentation | ||
| - **[README.md](../README.md)** - Main project README with setup, release notes, and workflow instructions | ||
| - **[.github/copilot-instructions.md](../.github/copilot-instructions.md)** - AI assistant instructions for code generation | ||
|
|
||
| ### Build Scripts | ||
| - **`notes.mjs`** - Self-hosted release notes generator (tag-based) | ||
| - **`pr-feed.mjs`** - SaaS development feed generator | ||
| - **`pr-utils.mjs`** - Shared utility functions | ||
|
|
||
| ### Configuration Files | ||
| - **`pr-feed-config.json`** - PR feed baseline configuration | ||
| - **`.docsearch/config.json`** - Algolia DocSearch configuration | ||
| - **`docs/.vuepress/config.ts`** - VuePress site configuration | ||
|
|
||
| --- | ||
|
|
||
| ## Contributing | ||
|
|
||
| When adding new internal documentation: | ||
|
|
||
| 1. **Place it in this directory** (`dev-docs/`) | ||
| 2. **Update this README** with a description and link | ||
| 3. **Reference from main README** if it's a key workflow | ||
| 4. **Keep it updated** as the implementation changes | ||
|
|
||
| --- | ||
|
|
||
| ## Notes | ||
|
|
||
| - This directory is for **internal/developer documentation only** | ||
| - User-facing documentation belongs in `/docs/` | ||
| - These files are **not** published to docs.rundeck.com | ||
| - Complements the Copilot instructions in `.github/` |
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.