Bug Description
Currently, there are two issues in
chunks_hybrid_search.py :
- Typo: The class is named
ChucksHybridSearchRetriever instead of ChunksHybridSearchRetriever.
|
|
|
class ChucksHybridSearchRetriever: |
|
def __init__(self, db_session): |
- Lack of Error Handling:
The embedding_model.embed(query_text) call is not wrapped in a try-except block. If the embedding service (e.g. OpenAI or Azure) fails or times out, the entire request crashes with a 500 error instead of gracefully falling back to keyword search.
|
from sqlalchemy import select |
|
from sqlalchemy.orm import joinedload |
|
|
|
from app.config import config |
|
from app.db import Chunk, Document |
|
|
|
# Get embedding for the query |
|
embedding_model = config.embedding_model_instance |
|
query_embedding = embedding_model.embed(query_text) |
Deployment Type
Steps to Reproduce
Expected Behavior
- Rename class to
ChunksHybridSearchRetriever.
- Catch exceptions during embedding generation. If it fails, log the error and retry or skip vector search , so that keyword search can still work.
I am happy to contribute a pull request to fix these issues once they are confirmed by the maintainers.
Actual Behavior
Screenshots/Videos
Environment Information
- Browser: Chrome 144
- Operating System: macOS 15
- SurfSense Version: self-hosted(latest version)
Additional Environment Details (for Self-hosted only)
- Python Version: [3.12.11]
- Node.js Version: [25.5.0]
- Database: [PostgreSQL 16]
- Deployment Method: [Docker]
Additional Context
Logs/Error Messages
Checklist
Bug Description
Currently, there are two issues in
chunks_hybrid_search.py:ChucksHybridSearchRetrieverinstead ofChunksHybridSearchRetriever.SurfSense/surfsense_backend/app/retriever/chunks_hybrid_search.py
Lines 3 to 5 in 8c60910
The embedding_model.embed(query_text) call is not wrapped in a try-except block. If the embedding service (e.g. OpenAI or Azure) fails or times out, the entire request crashes with a 500 error instead of gracefully falling back to keyword search.
SurfSense/surfsense_backend/app/retriever/chunks_hybrid_search.py
Lines 35 to 43 in 8c60910
Deployment Type
Steps to Reproduce
Expected Behavior
ChunksHybridSearchRetriever.I am happy to contribute a pull request to fix these issues once they are confirmed by the maintainers.
Actual Behavior
Screenshots/Videos
Environment Information
Additional Environment Details (for Self-hosted only)
Additional Context
Logs/Error Messages
Checklist