Skip to content

fix: rename ChunksHybridSearchRetriever and add embedding error handling#793

Open
Dayang26 wants to merge 2 commits intoMODSetter:mainfrom
Dayang26:fix/retriever-rename-and-error-handling
Open

fix: rename ChunksHybridSearchRetriever and add embedding error handling#793
Dayang26 wants to merge 2 commits intoMODSetter:mainfrom
Dayang26:fix/retriever-rename-and-error-handling

Conversation

@Dayang26
Copy link
Contributor

@Dayang26 Dayang26 commented Feb 7, 2026

This PR fixes a typo in the ChunksHybridSearchRetriever class name and improves the robustness of the search functionality by adding error handling for embedding generation.

Description

  1. Renamed Class: Changed ChucksHybridSearchRetriever to ChunksHybridSearchRetriever to fix the spelling error.
  2. Added Error Handling: Wrapped the embedding_model.embed(query_text) calls in try-except blocks within vector_search and hybrid_search.
  3. Graceful Failure: The search methods now log the error and return an empty list [] instead of crashing (or raising UnboundLocalError) when the embedding model fails to generate embeddings.

I didn't add a retry mechanism because I wanted to keep the changes minimal and avoid adding tenacity to pyproject.toml.

Motivation and Context

FIX #783

Screenshots

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

Close #783

High-level PR Summary

This PR corrects a typo in the class name from ChucksHybridSearchRetriever to ChunksHybridSearchRetriever and adds error handling to the vector_search method. When embedding generation fails, the method now logs the error and returns an empty list instead of crashing, improving the robustness of the search functionality.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_backend/app/retriever/chunks_hybrid_search.py
2 surfsense_backend/app/services/connector_service.py

Need help? Join our Discord

Analyze latest changes

@vercel
Copy link

vercel bot commented Feb 7, 2026

@Dayang26 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

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

Review by RecurseML

🔍 Review performed on d970688..cd82e78

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (2)

surfsense_backend/app/retriever/chunks_hybrid_search.py
surfsense_backend/app/services/connector_service.py

@MODSetter
Copy link
Owner

@Dayang26 Thanks. Can you please raise this PR on 'dev' branch

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.

[BUG] Rename ChucksHybridSearchRetriever and add error handling for embedding generation

2 participants