You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#1058 added Schema.add_analyzer / Schema.from_toml / Schema.from_toml_file / Schema.to_toml / Schema.to_toml_file to laurus-python, letting Python callers register a custom AnalyzerDefinition (char filters + tokenizer + token filters) and load/save the same TOML format laurus-cli create index --schema accepts. No other language binding has equivalent functionality yet:
laurus-ruby's docs/comments reference an add_analyzer that does not exist yet.
laurus-nodejs's Schema already accepts a serde_json::Value directly for related config (see laurus-nodejs/src/schema.rs), so it may be able to reuse the exact same JSON shape laurus-python uses ({"type": "...", ...} per component) with comparatively little new code.
laurus-wasm's existing add_analyzer is an unrelated, different concept (it registers a runtime WasmJapaneseAnalyzer object, not an AnalyzerDefinition) and would need a distinct API rather than a direct port.
Suggested direction
For each binding, evaluate and implement (as separate PRs, likely tracked as sub-issues of this one):
laurus-nodejs: add add_analyzer/from_toml/from_toml_file/to_toml/to_toml_file (or the binding's idiomatic equivalent), reusing the laurus-python implementation's JSON shape and error-handling approach (see feat(python): support custom analyzer definitions and TOML schema loading in laurus-python #1058's PR description for the design rationale, e.g. why tokenizer is required and filters are optional/keyword-only in Python — evaluate whether the same reasoning applies to Node's calling conventions).
laurus-ruby: same, adapted to Ruby idioms (e.g. keyword arguments), and fix the stale doc/comment reference to a not-yet-implemented add_analyzer.
laurus-wasm: design a distinct API (its existing add_analyzer name is already taken by an unrelated concept), or pick a different method name to avoid confusion.
Decision (2026-09-17)
After investigation, a blocker was found: core's Schema::from_toml/to_toml are #[cfg(not(target_arch = "wasm32"))]-gated, so laurus-wasm cannot call them as-is. Decision: lift the core wasm32 gate (verified against an actual wasm32 build) and deliver all three bindings (Ruby, Node.js, WASM) together in a single PR rather than splitting WASM into a follow-up issue. The new WASM method is named addAnalyzerDefinition to avoid colliding with the existing, unrelated addAnalyzer. Full rationale in the investigation/plan comment below.
Acceptance criteria
laurus-ruby, laurus-nodejs, and laurus-wasm all have feature parity with laurus-python's Schema.add_analyzer/TOML I/O.
Stale documentation referencing a not-yet-implemented add_analyzer (e.g. in laurus-ruby) is corrected or resolved.
Task list
Investigation & plan
Commit 1: feat(core): allow Schema::from_toml/to_toml to compile on wasm32
Summary
#1058 added
Schema.add_analyzer/Schema.from_toml/Schema.from_toml_file/Schema.to_toml/Schema.to_toml_filetolaurus-python, letting Python callers register a customAnalyzerDefinition(char filters + tokenizer + token filters) and load/save the same TOML formatlaurus-cli create index --schemaaccepts. No other language binding has equivalent functionality yet:laurus-ruby's docs/comments reference anadd_analyzerthat does not exist yet.laurus-nodejs'sSchemaalready accepts aserde_json::Valuedirectly for related config (seelaurus-nodejs/src/schema.rs), so it may be able to reuse the exact same JSON shapelaurus-pythonuses ({"type": "...", ...}per component) with comparatively little new code.laurus-wasm's existingadd_analyzeris an unrelated, different concept (it registers a runtimeWasmJapaneseAnalyzerobject, not anAnalyzerDefinition) and would need a distinct API rather than a direct port.Suggested direction
For each binding, evaluate and implement (as separate PRs, likely tracked as sub-issues of this one):
laurus-nodejs: addadd_analyzer/from_toml/from_toml_file/to_toml/to_toml_file(or the binding's idiomatic equivalent), reusing thelaurus-pythonimplementation's JSON shape and error-handling approach (see feat(python): support custom analyzer definitions and TOML schema loading in laurus-python #1058's PR description for the design rationale, e.g. whytokenizeris required and filters are optional/keyword-only in Python — evaluate whether the same reasoning applies to Node's calling conventions).laurus-ruby: same, adapted to Ruby idioms (e.g. keyword arguments), and fix the stale doc/comment reference to a not-yet-implementedadd_analyzer.laurus-wasm: design a distinct API (its existingadd_analyzername is already taken by an unrelated concept), or pick a different method name to avoid confusion.Decision (2026-09-17)
After investigation, a blocker was found: core's
Schema::from_toml/to_tomlare#[cfg(not(target_arch = "wasm32"))]-gated, solaurus-wasmcannot call them as-is. Decision: lift the core wasm32 gate (verified against an actual wasm32 build) and deliver all three bindings (Ruby, Node.js, WASM) together in a single PR rather than splitting WASM into a follow-up issue. The new WASM method is namedaddAnalyzerDefinitionto avoid colliding with the existing, unrelatedaddAnalyzer. Full rationale in the investigation/plan comment below.Acceptance criteria
laurus-ruby,laurus-nodejs, andlaurus-wasmall have feature parity withlaurus-python'sSchema.add_analyzer/TOML I/O.add_analyzer(e.g. inlaurus-ruby) is corrected or resolved.Task list
feat(core): allow Schema::from_toml/to_toml to compile on wasm32feat(ruby): add custom analyzer definitions and TOML schema I/Ofeat(nodejs): add custom analyzer definitions and TOML schema I/Ofeat(wasm): add custom analyzer definitions and TOML schema I/ORelated