-
Notifications
You must be signed in to change notification settings - Fork 666
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
Message search #3664
Message search #3664
Conversation
93f9c98
to
b088786
Compare
173d46d
to
f13543b
Compare
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.
We do need some extra UI to allow searching all channels on network, or even all networks.
Thinking about it in the scope of this PR because it may require a different archicture before we move further.
src/plugins/messageStorage/sqlite.js
Outdated
canProvideMessages() { | ||
return this.isEnabled; | ||
} | ||
} | ||
|
||
module.exports = MessageStorage; | ||
|
||
function parseRowToMessage(row) { |
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.
There's resolve in getMessages
that should re-use this function (minus setting the id).
That being said, we need to have global ids somehow stored in sqlite because when we will want to dynamically load history from sqlite in channel history, we will not be able to assign incremental ids to them as it will be out of order.
:message="message" | ||
/> | ||
<Message | ||
:key="message.time" |
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.
I had this happen:
[Vue warn]: Duplicate keys detected: '2019-12-27T18:15:45.232Z'. This may cause an update error.
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.
Also, context menus need fixing as they rely on activeChannel
and that breaks context menus in search:
vue.js:105 TypeError: Cannot read property 'network' of null
at VueComponent.openUserContextMenu
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.
I'm getting duplicate key errors just by running a single search. There's no guarantee that the dates are unique and I indeed have two messages with the exact same date in my history. I don't know what to do about that since we don't have unique message IDs :(
aria-relevant="additions" | ||
> | ||
<template v-for="(message, id) in messages"> | ||
<DateMarker |
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.
This might be too noisy, I tried searching something and almost half of the results were date markers.
f13543b
to
c2f1b20
Compare
a7195ac
to
c28a880
Compare
@@ -501,6 +501,11 @@ Client.prototype.more = function(data) { | |||
}; | |||
}; | |||
|
|||
Client.prototype.search = function(query) { | |||
const messageStorage = this.messageStorage.find((s) => s.canProvideMessages()); | |||
return messageStorage.search(query); |
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.
Need to handle the case when sqlite is disabled.
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.
We still need some kind of handling (and probably hiding the search UI) if sqlite is disabled OR if user has logs disabled.
const params = [`%${query.searchTerm}%`]; | ||
|
||
if (query.searchNicks) { | ||
select += ' OR json_extract(msg, "$.from.nick") LIKE ?)'; |
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.
Shouldn't this be AND
if you want to search that a user has said?
|
d257143
to
9aa5864
Compare
9aa5864
to
99cfba6
Compare
1ca52b9
to
bc117e2
Compare
Points 1, 2, 3 and 5 should be fixed now. Clicking show more adds messages to the top and keeps scroll position. Point 1 still needs testing but seems to work ok for me. |
Co-Authored-By: Pavel Djundik <xPaw@users.noreply.github.com>
Co-Authored-By: Pavel Djundik <xPaw@users.noreply.github.com>
bc117e2
to
af86d85
Compare
I think because there is no 'activeChannel'. |
@@ -170,10 +170,12 @@ export function generateChannelContextMenu($root, channel, network) { | |||
} | |||
|
|||
export function generateUserContextMenu($root, channel, network, user) { | |||
const currentChannelUser = channel.users.find((u) => u.nick === network.nick) || {}; | |||
const currentChannelUser = channel |
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.
(channel && channel.users.find((u) => u.nick === network.nick)) || {}
is slightly cleaner
Yes to both 1. and 2. please. It would be more consistent with the rest of the client. Please also add this to the context menus so it is easy to find (e.g. I assume it's normal behaviour to right click a channel in the network-/channel list to search in it). |
af86d85
to
b4d02c3
Compare
Some suggestions/comments:
Edit: I should have mentioned before all of this that I love this PR and it is working great for me. The above comments are mostly nit-picking! |
Thanks for this, it's great! Will it land in time for 4.3.0? |
@richrd Is there anything specific needed (help-wise, I mean)? From what I saw from the comments above, it seems to be working well for other people. |
At least a rebase has to be done. "Channels with upper case letters in the name cannot be searched" seems to be on the TODO-list, and @xPaw has stated quite a few things that has to be fixed. There was also some questions about how to filter the search, e.g. search just messages from user X, older than X etc. If this is added the PR may have to be redone regarding the implementation. Personally I would love to see a rebase, get the channel upper case letters bug fixed, fix @xPaw's review comments, and then merged to master. If we want to add search filter and other stuff later, someone can redo the implementation if needed. Another option would be to just rebase the PR. Then we can at least use it by running TL from source and merge this PR locally. |
This is mainly similar to #2627 except it's all on vue.
What this does:
LIKE %keyword%
. This might require some improvement to get more relevant resultsTODO:
Things to improve after this MVP: