This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add filters to search. #324
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
44e2933
Merge branch 'erikj/filter_refactor' into erikj/search
erikjohnston c8baada
Filter search results
erikjohnston 5c41224
Filter room ids before hitting the database
erikjohnston 4d25bc6
Move FTS to delta 25
erikjohnston f142898
PEP8
erikjohnston 8a98f0d
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/se…
erikjohnston 1fc2d11
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/se…
erikjohnston ba02bba
Limit max number of SQL vars
erikjohnston 232beb3
Use namedtuple as return value
erikjohnston fb0fecd
LESS THAN
erikjohnston 2980136
Rename
erikjohnston 671ac69
Actually filter results
erikjohnston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,10 +36,12 @@ def search_msgs(self, room_ids, search_term, keys): | |
clauses = [] | ||
args = [] | ||
|
||
clauses.append( | ||
"room_id IN (%s)" % (",".join(["?"] * len(room_ids)),) | ||
) | ||
args.extend(room_ids) | ||
# Make sure we don't explode because the person is in too many rooms. | ||
if len(room_ids) > 500: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean the clauses are added if the user is in more than 500 rooms? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the clauses are omitted do we have a way to ensure that the user only sees the events for the rooms they are in? |
||
clauses.append( | ||
"room_id IN (%s)" % (",".join(["?"] * len(room_ids)),) | ||
) | ||
args.extend(room_ids) | ||
|
||
local_clauses = [] | ||
for key in keys: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 assume that
filtr
is becausefilter
is a builtin. I'd prefer something likesearch_filter
rather than dropping vowels.