Skip to content

Add Tokenizer Mode Support for Message Search#31540

Closed
shinaoka wants to merge 2 commits into
element-hq:developfrom
shinaoka:shinaoka/ngram_PR
Closed

Add Tokenizer Mode Support for Message Search#31540
shinaoka wants to merge 2 commits into
element-hq:developfrom
shinaoka:shinaoka/ngram_PR

Conversation

@shinaoka

@shinaoka shinaoka commented Dec 14, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR adds a user-facing setting to choose the tokenizer mode for local message search. N-gram tokenization is essential for languages without clear word boundaries such as Japanese, Chinese, and Korean (CJK languages).

Changes

  • Add tokenizer mode setting (Standard/Japanese) in Message Search preferences
  • Pass tokenizer mode to Seshat via element-desktop IPC
  • Add confirmation dialog when changing tokenizer mode (requires reindex)

Dependencies

⚠️ This PR depends on:

Both upstream PRs must be merged before this PR can be merged.

Merge Order

1. Seshat PR #150  →  npm release (e.g., matrix-seshat@4.1.0)
2. element-desktop PR  →  update matrix-seshat dependency
3. element-web (this PR)  →  UI for tokenizer mode selection

Checklist

@t3chguy

t3chguy commented Dec 15, 2025

Copy link
Copy Markdown
Member

@shinaoka seems like you have lint & insufficient test coverage issues

@shinaoka

Copy link
Copy Markdown
Contributor Author

I have managed to fix the CI errors!

@t3chguy

t3chguy commented Jan 2, 2026

Copy link
Copy Markdown
Member

Blocked on matrix-org/seshat#150

@dbkr dbkr added the X-Needs-Product More input needed from the Product team label Jan 8, 2026
@langleyd

langleyd commented Feb 4, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution @shinaoka , this seems like a very valuable one.
The product team need a bit of time to consider how we should handle this mode in the UX.
It'll be next week before we have a response.

@shinaoka

Copy link
Copy Markdown
Contributor Author

Should I proceed? @langleyd

@daniellekirkwood

daniellekirkwood commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

Looks like this is an improvement for users -- thank you for the contribution, and thank you for your patience.

From a product perspective, we think in the future we might be able to make search a much better experience but I don't want to hold off on this change waiting for that future... So let's move ahead here but know that we may choose to update the Search UI & UX in the future 🙏

@langleyd langleyd removed X-Needs-Product More input needed from the Product team X-Blocked labels Feb 23, 2026
Rebased onto latest develop with monorepo directory structure (apps/web/).

- Add tokenizer mode setting (Standard/Japanese) in Message Search preferences
- Pass tokenizer mode to Seshat via element-desktop IPC
- Add confirmation dialog when changing tokenizer mode (requires reindex)
- Add tests for tokenizer mode functionality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Half-Shot

Copy link
Copy Markdown
Member

Converting to draft while element-hq/element-desktop#2753 is outstanding so it doesn't end up in our review queue :)

@shinaoka

Copy link
Copy Markdown
Contributor Author

Updated this PR with a fix for the tokenizer-change flow in element-web and added a regression test. This is still waiting on the element-desktop and seshat side changes.

@shinaoka

Copy link
Copy Markdown
Contributor Author

Since element-desktop has been merged into element-web (monorepo), I've prepared a new branch (shinaoka/tokenizer-mode) based on the latest develop that includes both:

Would it be OK to open a new PR from that branch to replace this one? This would keep everything in a single PR and avoid merging ~3500 commits of drift into this branch.

I'll reference this PR and its discussion in the new one.

@langleyd

langleyd commented Apr 2, 2026

Copy link
Copy Markdown
Member

Sounds good, thanks

@shinaoka
shinaoka marked this pull request as ready for review May 5, 2026 23:50
@shinaoka

shinaoka commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

I forgot to make it ready for review...

@@ -0,0 +1,60 @@
/*
Copyright 2024 New Vector Ltd.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be your copyright, with the present year

Comment on lines +2 to +3
Copyright 2025 New Vector Ltd.
Copyright 2020, 2021 The Matrix.org Foundation C.I.C.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@@ -0,0 +1,195 @@
/*
Copyright 2025 New Vector Ltd.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Comment on lines +2 to +3
Copyright 2025 New Vector Ltd.
Copyright 2020, 2021 The Matrix.org Foundation C.I.C.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Comment on lines +2 to +3
Copyright 2025 New Vector Ltd.
Copyright 2020, 2021 The Matrix.org Foundation C.I.C.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Comment on lines +2 to +3
Copyright 2025 New Vector Ltd.
Copyright 2020, 2021 The Matrix.org Foundation C.I.C.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

"RoomList.showMessagePreview": IBaseSetting<boolean>;
"RightPanel.phasesGlobal": IBaseSetting<IRightPanelForRoomStored | null>;
"RightPanel.phases": IBaseSetting<IRightPanelForRoomStored | null>;
"enableEventIndexing": IBaseSetting<boolean>;
"crawlerSleepTime": IBaseSetting<number>;
"tokenizerMode": IBaseSetting<string>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be "language" | "ngram"?

@t3chguy

t3chguy commented May 8, 2026

Copy link
Copy Markdown
Member

Please include some screenshots in the PR of the new UI/modals

@shinaoka

Copy link
Copy Markdown
Contributor Author

I have posted some screenshots in the new PR:
#33048

Let me close this PR in favor of the new one.

@shinaoka shinaoka closed this May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Enhancement Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants