sdelements / lets-chat

Self-hosted chat app for small teams
http://sdelements.github.io/lets-chat
MIT License
9.78k stars 1.58k forks source link

Chat History : improvements in search function and features to be added #485

Open mmeinert opened 9 years ago

mmeinert commented 9 years ago

Search in Chat History (transcript) only works for full text : can't find hell from hello for example. Search didn't work at all with mongodb shipped by Debian and now works partially with the package of the official repo (3.0.3) using Let's Chat 0.4.0

Features needed :

Thank you

mmeinert commented 9 years ago

I'm looking for a solution, I think I'm close but I can't progress on it...

In media/js/views/transcript.js we can see

search: _.throttle(function() {
            this.query = this.$query.val()
            this.loadTranscript();
        }, 400, {leading: false}),
        loadTranscript: function() {
            var that = this;
            this.clearMessages();
            $.get('./messages', {
                room: this.room.id,
                from: moment(this.startDate).utc().toISOString(),
                to: moment(this.endDate).utc().toISOString(),
                query: this.query,
                expand: 'owner',
                reverse: false,
                take: 5000
            }, function(messages) {
                _.each(messages, function(message) {
                    that.addMessage(message);
                });
            });
        },

I think this.query should be transformed in something like /this.query/ to return words which contains letters inserted in the search box.

Or, make wildcards characters like "%" works

Searching in the users collection should be also great. This way i can see all the conversations of a specific user (user:xxxx in the search box ?)

What do you think about that ?