Skip to content

fix: improve search for period-prefixed terms like .gitignore and .rooignore #291

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

Closed
wants to merge 1 commit into from

Conversation

roomote[bot]
Copy link
Contributor

@roomote roomote bot commented Aug 1, 2025

This PR fixes the search functionality for terms that start with a period (like .gitignore and .rooignore).

Problem

The search plugin's tokenization process strips out periods from search terms during both indexing and searching, making it impossible to find documentation about .rooignore, .gitignore, and similar period-prefixed terms.

Solution

Created a custom SearchBar wrapper component that:

  1. Intercepts search queries before they are processed
  2. Detects period-prefixed terms (e.g., .gitignore)
  3. Automatically expands the search to include both the original term and the term without the period
  4. This ensures that content indexed without the period can still be found

Technical Details

  • The fix is implemented as a Docusaurus theme component override
  • It wraps the original SearchBar component and intercepts the autocomplete functionality
  • When a period-prefixed term is detected, it modifies the query to search for both versions
  • This approach works around the tokenization limitation without modifying the search plugin itself

Testing

  • Built the documentation site successfully with npm run build
  • The solution should allow users to search for .rooignore, .gitignore, and other period-prefixed terms

Fixes RooCodeInc/Roo-Code#6508


Important

Fixes search for period-prefixed terms by expanding queries to include both original and non-period versions in a custom SearchBarWrapper.

  • Behavior:
    • Fixes search for period-prefixed terms like .gitignore and .rooignore by expanding queries to include both original and non-period versions.
    • Implemented in index.js as a Docusaurus theme component override.
  • Technical Details:
    • SearchBarWrapper component wraps OriginalSearchBar and intercepts autocomplete.
    • Uses processQuery() to modify queries, adding OR clauses for period-prefixed terms.
    • Utilizes MutationObserver and periodic checks to ensure interception.
  • Testing:
    • Documentation site built successfully with npm run build.
    • Allows searching for period-prefixed terms effectively.

This description was created by Ellipsis for f3e408a. You can customize this summary. It will automatically update as commits are pushed.

…oignore

- Created custom SearchBar wrapper component that intercepts search queries
- Automatically expands period-prefixed terms to search both with and without the period
- This works around the tokenization issue where periods are stripped during indexing
- Fixes RooCodeInc/Roo-Code#6508
Copy link

vercel bot commented Aug 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
roo-code-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2025 2:16am


// Get the original getVal and setVal methods
const originalGetVal = autocompleteInstance.getVal.bind(autocompleteInstance);
const originalSetVal = autocompleteInstance.setVal.bind(autocompleteInstance);
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused 'originalSetVal' is bound but never used; consider removing it.

Suggested change
const originalSetVal = autocompleteInstance.setVal.bind(autocompleteInstance);

matches.forEach(match => {
const termWithoutPeriod = match.substring(1); // Remove the leading period
// Replace the term with an OR expression
processedQuery = processedQuery.replace(
Copy link
Contributor

Choose a reason for hiding this comment

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

Using string.replace inside a loop may cause duplicate or nested replacements if the same period-prefixed term appears more than once. Consider a global regex replacement or safeguard against re-matching replaced text.

@daniel-lxs
Copy link
Collaborator

Not a proper fix

@daniel-lxs daniel-lxs closed this Aug 2, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Aug 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

When searching help docs if there is a period (.) in front of the search it will not return results.
2 participants