Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

search_suggestion: Canonicalize search text terms before suggesting.

Evy Kassirerb31d3ce5b967
diff --git a/web/src/search_suggestion.ts b/web/src/search_suggestion.ts
index e7fdec17720..e86f4d05c29 100644
--- a/web/src/search_suggestion.ts
+++ b/web/src/search_suggestion.ts
@@ -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.
diff --git a/web/tests/search_suggestion.test.cjs b/web/tests/search_suggestion.test.cjs
index dfdfce8f4ae..458dd28dae4 100644
--- a/web/tests/search_suggestion.test.cjs
+++ b/web/tests/search_suggestion.test.cjs
@@ -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",
+ ];
assert.deepEqual(suggestions.strings, expected);
query = "dm:t";