Skip to content
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

API Updates to support conversation search #5913

Open
Tracked by #5910
pranavrajs opened this issue Nov 22, 2022 · 4 comments
Open
Tracked by #5910

API Updates to support conversation search #5913

pranavrajs opened this issue Nov 22, 2022 · 4 comments
Assignees

Comments

@pranavrajs
Copy link
Member

pranavrajs commented Nov 22, 2022

API improvements in conversation search

@tejaswinichile
Copy link
Contributor

Investigation around multi-model full-text search:

This is mainly for which model will be a good fit for search enhancement around multiple models.

We have joins on contacts and conversations, and having an 'ILIKE' search is not good according to performance until and unless we write a raw query

another approach is to use materialized view - which doesn't get updated on its own, so we will need to write a stored procedure for the same to update the DB views

The third approach is using the pg_search gem, which comes up with a multi-search model I am currently screening this.

@tejaswinichile
Copy link
Contributor

tejaswinichile commented Dec 5, 2022

Notes:

The search is working well on the multi-search-model there are some limitations while creating the pg_search_document for contact as we wanted to save the conversation_id associated with the contact.

And conversation_id is not available until and unless contact is created, so after_save callback to create pg_search text with conversation_id was not working, so I moved it to the conversation model.

It was a recommended approach in this issue Casecommons/pg_search#121

While deploying this feature, we would need to rebuild the pg_search_document record for Message, COnversation, and Contact models. I will be writing migration for the same, but there would be downtime considering the number of messages we have in the system. However, pg_search handles this creation of records in the batches.

Now the limitation that I found in UX.

Suppose we search with the name 'XYZ' and then with a conversation card. Should we show any messages? Before, it made sense as we were only searching in the messages table. Need a discussion for this.

cc @pranavrajs

@tejaswinichile
Copy link
Contributor

@pranavrajs
Copy link
Member Author

pranavrajs commented Dec 5, 2022

@tejaswinichile Is it possible to return the model name which matches the query?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants