Skip to content

Commit a678e5d

Browse files
committed
limit slack search to avoid overloading the search
1 parent cfa3c3d commit a678e5d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

backend/onyx/context/search/federated/slack_search.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from sqlalchemy.orm import Session
1010

1111
from onyx.configs.app_configs import ENABLE_CONTEXTUAL_RAG
12+
from onyx.configs.app_configs import NUM_FEDERATED_SECTIONS
1213
from onyx.configs.app_configs import NUM_MAX_SLACK_QUERIES
1314
from onyx.configs.app_configs import NUM_SLACK_SEARCH_DOCS
1415
from onyx.configs.app_configs import SLACK_USER_TOKEN
@@ -284,4 +285,7 @@ def slack_retrieval(query: SearchQuery, db_session: Session) -> list[InferenceCh
284285
updated_at=docid_to_message[document_id].timestamp,
285286
)
286287
)
288+
if len(top_chunks) >= NUM_FEDERATED_SECTIONS:
289+
break
290+
287291
return top_chunks

0 commit comments

Comments
 (0)