mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
search_suggestion: Canonicalize search text terms before suggesting.
Fixes bug reported here https://chat.zulip.org/#narrow/channel/9-issues/topic/search.20typeahead.20duplicates.20.22sent.20by.20me.22/near/2183976
This commit is contained in:
@@ -1050,7 +1050,7 @@ export function get_search_result(
|
||||
add_current_filter = false,
|
||||
): Suggestion[] {
|
||||
let suggestion_line: SuggestionLine;
|
||||
|
||||
text_search_terms = text_search_terms.map((term) => Filter.canonicalize_term(term));
|
||||
// search_terms correspond to the terms for the query in the input.
|
||||
// This includes the entire query entered in the searchbox.
|
||||
// terms correspond to the terms for the entire query entered in the searchbox.
|
||||
|
||||
@@ -184,7 +184,15 @@ test("dm_suggestions", ({override, mock_template}) => {
|
||||
|
||||
query = "is:private";
|
||||
suggestions = get_suggestions(query);
|
||||
expected = ["is:dm"];
|
||||
// Same search suggestions as for "is:dm"
|
||||
expected = [
|
||||
"is:dm",
|
||||
"dm:alice@zulip.com",
|
||||
"dm:bob@zulip.com",
|
||||
"dm:jeff@zulip.com",
|
||||
"dm:myself@zulip.com",
|
||||
"dm:ted@zulip.com",
|
||||
];
|
||||
assert.deepEqual(suggestions.strings, expected);
|
||||
|
||||
query = "dm:t";
|
||||
|
||||
Reference in New Issue
Block a user