Skip to content

Commit b6dcdea

Browse files
authored
Merge pull request rundeck#1758 from rundeck/search-tags
Add section-based search filtering
2 parents 6985058 + 5a41226 commit b6dcdea

File tree

10 files changed

+819
-10
lines changed

10 files changed

+819
-10
lines changed

.docsearch/config.json

Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,105 @@
22
"index_name": "prod_rundeck_docs",
33
"js_render": false,
44
"start_urls": [
5+
{
6+
"url": "https://docs.rundeck.com/(?P<version>.*?)/learning/",
7+
"variables": {
8+
"version": [
9+
"docs",
10+
"4.0.x"
11+
]
12+
},
13+
"tags": ["Learning"]
14+
},
15+
{
16+
"url": "https://docs.rundeck.com/(?P<version>.*?)/manual/",
17+
"variables": {
18+
"version": [
19+
"docs",
20+
"4.0.x"
21+
]
22+
},
23+
"tags": ["User Guide"]
24+
},
25+
{
26+
"url": "https://docs.rundeck.com/(?P<version>.*?)/api/",
27+
"variables": {
28+
"version": [
29+
"docs",
30+
"4.0.x"
31+
]
32+
},
33+
"tags": ["API"]
34+
},
35+
{
36+
"url": "https://docs.rundeck.com/(?P<version>.*?)/administration/",
37+
"variables": {
38+
"version": [
39+
"docs",
40+
"4.0.x"
41+
]
42+
},
43+
"tags": ["Administration"]
44+
},
45+
{
46+
"url": "https://docs.rundeck.com/(?P<version>.*?)/developer/",
47+
"variables": {
48+
"version": [
49+
"docs",
50+
"4.0.x"
51+
]
52+
},
53+
"tags": ["Developer"]
54+
},
55+
{
56+
"url": "https://docs.rundeck.com/(?P<version>.*?)/history/cves/",
57+
"variables": {
58+
"version": [
59+
"docs",
60+
"4.0.x"
61+
]
62+
},
63+
"tags": ["Administration"]
64+
},
65+
{
66+
"url": "https://docs.rundeck.com/(?P<version>.*?)/history/",
67+
"variables": {
68+
"version": [
69+
"docs",
70+
"4.0.x"
71+
]
72+
},
73+
"tags": ["Release Notes"]
74+
},
75+
{
76+
"url": "https://docs.rundeck.com/(?P<version>.*?)/rd-cli/",
77+
"variables": {
78+
"version": [
79+
"docs",
80+
"4.0.x"
81+
]
82+
},
83+
"tags": ["User Guide"]
84+
},
85+
{
86+
"url": "https://docs.rundeck.com/(?P<version>.*?)/upgrading/",
87+
"variables": {
88+
"version": [
89+
"docs",
90+
"4.0.x"
91+
]
92+
},
93+
"tags": ["Administration"]
94+
},
595
{
696
"url": "https://docs.rundeck.com/(?P<version>.*?)/",
797
"variables": {
898
"version": [
999
"docs",
10100
"4.0.x"
11101
]
12-
}
102+
},
103+
"tags": ["General"]
13104
}
14105
],
15106
"stop_urls": [
@@ -41,7 +132,8 @@
41132
"custom_settings": {
42133
"attributesForFaceting": [
43134
"version",
44-
"lang"
135+
"lang",
136+
"tags"
45137
]
46138
}
47139
}

.github/copilot-instructions.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,18 @@ You are an AI assistant helping maintain the Rundeck documentation site.
3939
- Code blocks should specify language for proper syntax highlighting
4040
- Use numbered lists for sequential steps
4141
- Use bullet points for non-sequential items
42-
- Tables should have headers and consistent column formatting
42+
- Tables should have headers and consistent column formatting
43+
44+
## Search Setup
45+
46+
### Architecture
47+
- **Search Provider**: Algolia DocSearch via `@vuepress/plugin-docsearch`
48+
- **Index Name**: `prod_rundeck_docs`
49+
- **Indexing**: Automated via CircleCI using `algolia/docsearch-scraper` Docker image
50+
- **Configuration Files**:
51+
- `.docsearch/config.json` - Algolia scraper configuration (selectors, start URLs, faceting attributes)
52+
- `docs/.vuepress/config.ts` - VuePress DocSearch plugin configuration (appId, apiKey, search parameters)
53+
- **Current Facets**: `version` (filters by docs version like "docs", "4.0.x") and `lang`
54+
- **Section-Based Filtering**: Uses `tags` attribute to enable filtering by documentation section (learning, manual, api, administration, developer, etc.)
55+
- **Indexing Strategy**: Tags are applied via URL patterns in `start_urls` to categorize content by documentation section
56+
- **Custom Implementation**: Section filter checkboxes can be added via custom search UI using Algolia InstantSearch or DocSearch customization

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ git push origin
9696
## Documentation Structure
9797

9898
The documentation is organized as follows:
99-
- `/docs/` - Main documentation content
99+
- `/docs/` - Main documentation content (published to docs.rundeck.com)
100100
- `/docs/.vuepress/` - VuePress configuration
101101
- `/docs/.vuepress/public/assets/img/` - Images Folder
102+
- `/dev-docs/` - Internal developer documentation (scripts, architecture, workflows)
102103

103104
# How to Create Release Notes
104105

@@ -248,7 +249,7 @@ git push
248249

249250
## SaaS Development Updates Feed
250251

251-
For generating RSS/Atom feeds and markdown pages showing recent PRs deployed to the SaaS platform (but not yet in self-hosted releases), see [PR-FEED-README.md](./PR-FEED-README.md).
252+
For generating RSS/Atom feeds and markdown pages showing recent PRs deployed to the SaaS platform (but not yet in self-hosted releases), see [dev-docs/PR-FEED-README.md](./dev-docs/PR-FEED-README.md).
252253

253254
This feed automatically tracks changes since the last self-hosted release and is updated after each SaaS deployment:
254255

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# DocSearch Filters Integration
2+
3+
This guide explains how to integrate the section filtering component into your Rundeck documentation search.
4+
5+
## Components Created
6+
7+
### 1. DocSearchFilters.vue
8+
- Location: `docs/.vuepress/components/DocSearchFilters.vue`
9+
- A Vue component that provides a filter button with a dropdown panel
10+
- Shows section checkboxes (Learning, User Guide, API, Administration, Developer, Release Notes, General)
11+
- Persists filter selections in localStorage
12+
- Dispatches custom events when filters change
13+
14+
### 2. docsearch-filters.ts Plugin
15+
- Location: `docs/.vuepress/plugins/docsearch-filters.ts`
16+
- Client-side plugin that integrates filters with DocSearch
17+
- Listens for filter update events and applies them to DocSearch
18+
- Monitors DocSearch modal for filter restoration
19+
20+
### 3. Client Configuration Updates
21+
- Updated `docs/.vuepress/client.ts` to initialize the filter integration
22+
- Imports and calls `initializeDocSearchFilters()` on app startup
23+
24+
## Integration in Layout
25+
26+
The filter button is **automatically injected** into the navbar by the client configuration. No manual component placement is needed.
27+
28+
The `injectDocSearchFiltersIntoNavbar()` function in `client.ts` automatically:
29+
1. Waits for the DocSearch container to be rendered
30+
2. Creates a wrapper element next to the search container
31+
3. Mounts the `DocSearchFilters` component dynamically
32+
33+
This ensures the filter component appears right next to the search button without requiring manual template modifications.
34+
35+
## How It Works
36+
37+
1. **User clicks the filter button** (funnel icon with badge)
38+
2. **Filter dropdown opens** showing available section tags
39+
3. **User selects/deselects sections** via checkboxes
40+
4. **Selections are stored** in localStorage for persistence
41+
5. **Filter state is dispatched** via custom `docsearch-filters-updated` event
42+
6. **Plugin intercepts Algolia requests** - The `docsearch-filters.ts` plugin patches `fetch` and `XMLHttpRequest` to intercept all Algolia API calls
43+
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`)
44+
8. **Results are filtered by Algolia** - Algolia returns only results matching the selected section tags
45+
9. **Search input is triggered** - An input event is dispatched to refresh the search results with the new filters applied
46+
47+
## Configuration
48+
49+
### Available Sections
50+
The component currently supports these sections (from `config.json` tags):
51+
- Learning
52+
- User Guide
53+
- API
54+
- Administration
55+
- Developer
56+
- Release Notes
57+
- General
58+
59+
To add new sections:
60+
1. Update `.docsearch/config.json` to add new `start_urls` with tags
61+
2. Update the `sections` array in `DocSearchFilters.vue`
62+
63+
### VuePress Configuration
64+
The DocSearch configuration in `docs/.vuepress/config.ts` includes:
65+
```typescript
66+
searchParameters: {
67+
hitsPerPage: 100,
68+
facetFilters: [`version:${setup.base}`],
69+
facets: ['tags']
70+
}
71+
```
72+
73+
The `facets: ['tags']` tells Algolia to include tags as filterable attributes.
74+
75+
## Styling
76+
77+
The component uses VuePress theme variables for styling:
78+
- `--c-brand` - Brand color
79+
- `--c-border` - Border color
80+
- `--c-text-secondary` - Secondary text color
81+
- `--c-bg`, `--c-bg-light` - Background colors
82+
83+
It automatically adapts to dark mode using `html.dark` selector.
84+
85+
## Testing
86+
87+
To test the filters:
88+
89+
1. Build/run the docs: `npm run docs:dev`
90+
2. Click the filter button in the navbar
91+
3. Select a section (e.g., "Learning")
92+
4. Perform a search
93+
5. Results should only show items tagged with the selected section
94+
6. Refresh the page - filter selections persist via localStorage
95+
96+
## Troubleshooting
97+
98+
### Filters not appearing in results
99+
- Ensure Algolia index has been re-scraped with new tags
100+
- Check that `facets: ['tags']` is in the config
101+
- Verify the section tags match what's in `config.json`
102+
103+
### localStorage not working
104+
- Browser privacy mode disables localStorage
105+
- Clear localStorage and refresh if there are issues
106+
107+
### Component not visible
108+
- Ensure DocSearchFilters component is imported and placed in the layout
109+
- Check browser console for Vue component registration errors
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ This ensures the exact commits used in the build are compared, guaranteeing accu
362362

363363
## Related Documentation
364364

365-
- **[README.md](./README.md)** - Main documentation project setup and release notes generation
365+
- **[README.md](../README.md)** - Main documentation project setup and release notes generation
366366
- **`notes.mjs`** - Self-hosted release notes generator (uses same shared utilities)
367367
- **`pr-utils.mjs`** - Shared utility functions used by both scripts
368368

dev-docs/README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Developer Documentation
2+
3+
This directory contains internal documentation for developers working on the Rundeck documentation project. These guides cover build processes, automation scripts, and architectural decisions.
4+
5+
## Contents
6+
7+
### 📋 [PR-FEED-README.md](./PR-FEED-README.md)
8+
**SaaS Development Feed Generator**
9+
10+
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.
11+
12+
**Key Topics:**
13+
- Weekly SaaS release workflow
14+
- Tag-based PR comparison
15+
- Configuration management
16+
- Feed generation (RSS 2.0 and Atom 1.0)
17+
- Integration with release notes process
18+
19+
**Usage:** `npm run pr-feed`
20+
21+
---
22+
23+
### 🔍 [DOCSEARCH_FILTERS_README.md](./DOCSEARCH_FILTERS_README.md)
24+
**DocSearch Section Filters Integration**
25+
26+
Technical documentation for the custom DocSearch filter component that allows users to filter documentation search results by section (Learning, API, Administration, etc.).
27+
28+
**Key Topics:**
29+
- Component architecture (Vue + VuePress)
30+
- Client-side plugin integration
31+
- Algolia request interception
32+
- LocalStorage persistence
33+
- Automatic navbar injection
34+
35+
**Files Covered:**
36+
- `docs/.vuepress/components/DocSearchFilters.vue`
37+
- `docs/.vuepress/plugins/docsearch-filters.ts`
38+
- `docs/.vuepress/client.ts`
39+
40+
---
41+
42+
## Related Documentation
43+
44+
### Main Project Documentation
45+
- **[README.md](../README.md)** - Main project README with setup, release notes, and workflow instructions
46+
- **[.github/copilot-instructions.md](../.github/copilot-instructions.md)** - AI assistant instructions for code generation
47+
48+
### Build Scripts
49+
- **`notes.mjs`** - Self-hosted release notes generator (tag-based)
50+
- **`pr-feed.mjs`** - SaaS development feed generator
51+
- **`pr-utils.mjs`** - Shared utility functions
52+
53+
### Configuration Files
54+
- **`pr-feed-config.json`** - PR feed baseline configuration
55+
- **`.docsearch/config.json`** - Algolia DocSearch configuration
56+
- **`docs/.vuepress/config.ts`** - VuePress site configuration
57+
58+
---
59+
60+
## Contributing
61+
62+
When adding new internal documentation:
63+
64+
1. **Place it in this directory** (`dev-docs/`)
65+
2. **Update this README** with a description and link
66+
3. **Reference from main README** if it's a key workflow
67+
4. **Keep it updated** as the implementation changes
68+
69+
---
70+
71+
## Notes
72+
73+
- This directory is for **internal/developer documentation only**
74+
- User-facing documentation belongs in `/docs/`
75+
- These files are **not** published to docs.rundeck.com
76+
- Complements the Copilot instructions in `.github/`

0 commit comments

Comments
 (0)