Skip to content

Conversation

@sudhanshu112233shukla
Copy link

Universal Fuzzy Search Implementation

Summary

This PR implements Universal Fuzzy Search using Typesense. This feature allows users to perform typo-tolerant searches across:

  • Repositories: Search by name or organization.
  • Files: Search by filename or path.
  • Commits: Search by commit message, author, or hash.

Fixes #536

Changes

Infrastructure

  • Added typesense service to docker-compose.yml (v26.0).
  • Updated @sourcebot/shared env schema to include TYPESENSE_HOST, TYPESENSE_PORT, and TYPESENSE_API_KEY.

Backend (@sourcebot/backend)

  • New Service: TypesenseService (src/search/typesense.ts)
    • Handles connection to Typesense.
    • Manages schemas for repos, files, and commits collections.
    • Provides indexRepo, indexFiles, indexCommits, and search methods.
    • Includes Fail-Safe Guards: If Typesense is unreachable, indexing operations fail gracefully without crashing the main application.
  • Indexing Integration: Updated RepoIndexManager (src/repoIndexManager.ts) to trigger Typesense indexing asynchronously after the standard git indexing process.
  • Git Helpers: Added getAllFiles and getRecentCommits to src/git.ts.
  • API Endpoint: Added GET /api/search/fuzzy to src/api.ts.

Verification

  • Build: Verified yarn workspace @sourcebot/backend build succeeds.
  • Unit Tests: Added src/search/typesense.test.ts (Vitest).
    • Passed 7/7 tests verifying schema creation, data mapping, and query construction.
  • Manual Verification: Since Docker was unavailable in the dev environment, logic was strictly verified via unit tests and strict type checking.

Notes

  • Requires docker-compose up -d typesense to be running for search to work.
  • Search fails gracefully (returns error/logs warning) if the service is down.

( Screenshot result)

(Add screenshots of the UI if applicable, or API response examples)

// Example Response for /api/search/fuzzy?q=reacct
{
  "hits": [
    {
      "document": {
        "name": "facebook/react",
        "repo_id": 123
      }
    }
  ]
}

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sudhanshu112233shukla
Copy link
Author

@msukkari @brendan-kellam do check it , it is big change , but i am confident that it will work , please you guys also check it and tell me it it needs any more , changes , i have tested it as will , explained it in PR description , do check it , love to hear from you guys on this !!!

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.

[FR] Universal fuzzy search

1 participant