-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improved chat search #4137
Improved chat search #4137
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
backend/onyx/db/chat_search.py
Outdated
|
||
return list(chat_sessions), has_more | ||
return sessions, has_more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see what list[] was removed for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it was causing some typing issues!
|
||
|
||
def upgrade() -> None: | ||
# Create a GIN index for full-text search on chat_message.message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comments about why we needed this index and the improvement (per netflix context)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call!
865fa15
to
5bb6200
Compare
* functional + fast * k * adapt * k * nit * k * k * fix typing * k
Description
PR Description: Chat Search Optimization
Replaced the slow LIKE-based search with PostgreSQL full-text search using tsvector columns and GIN indexes
N.B. COMMIT statements in the migration are necessary because PostgreSQL requires CREATE INDEX CONCURRENTLY to run outside a transaction. Without them, the migration would fail with "CREATE INDEX CONCURRENTLY cannot run inside a transaction block"
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.