Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): message search without the index finds words typed with a curly apostrophe #27267

ClosedMarcoDotIO(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/27267/headopened View on GitHub

Showing 3 changed files with 35 additions and 1 deletion.

x
0 of 3 viewed, 3 left
29 additions and 0 deletionsapps/server/src/orchestration-v2/ThreadSearch.test.tsModified
View file
@@ -988,6 +988,35 @@
});
​
+it.layer(layerTest)("ThreadSearch without the index", (it) => {
+ it.effect("finds a curly apostrophe for a straight one and back", () =>
+ Effect.gen(function* () {
+ const projections = yield* ProjectionStore.ProjectionStoreV2;
+ const search = yield* ThreadSearch.ThreadSearch;
+ const sql = yield* SqlClient.SqlClient;
+ const project = ProjectId.make("project:scan-apostrophes");
+ const curly = ThreadId.make("thread:scan-apostrophe-curly");
+ const straight = ThreadId.make("thread:scan-apostrophe-straight");
+ yield* createProject(project);
+ yield* Effect.forEach(
+ [
+ thread(curly, project),
+ message(curly, "scan-apostrophe-curly", "user", "the gannet’s nest"),
+ thread(straight, project),
+ message(straight, "scan-apostrophe-straight", "user", "a kittiwake's nest"),
+ ],
+ projections.apply,
+ { discard: true },
+ );
+ yield* sql`DROP TABLE orchestration_v2_message_search`;
+ const threadIds = (query: string) =>
+ search.search({ query }).pipe(Effect.map(({ matches }) => matches.map((m) => m.threadId)));
+ assert.deepEqual(yield* threadIds("gannet's"), [curly]);
+ assert.deepEqual(yield* threadIds("kittiwake’s"), [straight]);
+ }),