Skip to content

[Feature]: Make the FTS text-analysis chain configurable (tokenizer, filters, extra_params) — hard-coded jieba + lowercase degrades every morphologically rich language #387

Todo

Description

@login4all

Problem or Motivation

The lexical (FTS/BM25) route is hard-coded to a Chinese segmentation tokenizer, and there is no way to
change it from the CLI, the configuration file, an environment variable, or the MCP interface. The FTS
index schema is created in exactly one place per implementation:

  • Rust workspace: rust/crates/zg-engine/src/domain/index.rs — pub(crate) const FTS_CONFIG: FtsConfig
    with tokenizer: "jieba", filters: &["lowercase"], consumed in
    rust/crates/zg-engine/src/storage/fragments/mod.rs as
    IndexParams::fts(Some(FTS_CONFIG.tokenizer), Some(FTS_CONFIG.filters), None) — the third argument
    (extra_params) is permanently None.
  • Node/TypeScript package: src/engine/storage/zvec.ts, inside createSchema() —
    tokenizerName: "jieba", filters: ["lowercase"], no extraParams.

The underlying engine already supports more than that (standard, whitespace, jieba, ngram;
filters lowercase, ascii_folding, stemmer; extra_params keys such as stemmer_lang,
ngram_min/ngram_max, cut_mode). So the capability exists one layer below the wrapper and is simply
not reachable.

This is not something the JS-to-native transition fixed — checked against the release that is current
today, @zvec/zvec-grep 0.3.0. The Rust workspace states the intent outright,
rust/crates/zg-engine/src/domain/index.rs:

/// Fixed FTS configuration for the current physical index format.
pub(crate) const FTS_CONFIG: FtsConfig = FtsConfig {
    tokenizer: "jieba",
    filters: &["lowercase"],
};

where FtsConfig { tokenizer: &'static str, filters: &'static [&'static str] } has no field for extra
parameters at all. Nothing in the workspace reaches this constant: searching rust/ for
fts[-_](tokenizer|filters|stemmer|lang), stemmer_lang or ZVEC_GREP_FTS returns only a benchmark
harness that reports "fts_tokenizer": "jieba".

The published binary tells the same story, and there the comparison is measurable. Unpacking
@zvec/zvec-grep-win32-x64-msvc 0.3.0 from my registry mirror (34.8 MB tarball, 98.2 MB unpacked, all 19
entries of its own checksums.json verified) and counting byte substrings per file gives:

file jieba stemmer stemmer_lang ascii_folding cut_mode ngram_min / ngram_max max_token_length
bin/zg.exe (wrapper) 3 0 0 0 0 0 / 0 0
lib/zvec_c_api.dll (engine) 30 4 1 1 3 3 / 3 3

In the wrapper's string table the tokenizer name is glued to its only filter
(…create collection schema…define full-text field…jieba…lowercase), while every parameter that makes the
analysis usable for an inflected language exists only in the engine's DLL — together with StemmerTokenFilter,
its error message [StemmerTokenFilter] failed to create stemmer for language: %s, and 31 Snowball language
identifiers including russian. So the gap is not a missing engine capability waiting to be built; it is one
constant in the wrapper plus a parameter that is always passed as None.

The version does report a tokenizer in its output structures (struct WorkspaceIndexFts, api/info.rs), it
just never accepts one as input: among 179 flag-like strings in bin/zg.exe nothing mentions an FTS schema
(--fts <query> is a query flag for an exact lexical term; --token-file and --mcp-token-env are MCP
authentication), and none of the ZVEC_GREP_* variables is FTS-related. Moving to 0.3.x would therefore also
remove the only workaround available today, because the dist/ layer that can be patched no longer ships.

Two consequences for non-Chinese documents:

  1. Morphological variants are unrelated terms. With filters: ["lowercase"] there is no stemmer at
    all, so an inflected language treats «архитектурное требование» and «архитектурных требований» as
    disjoint term sets, and the lexical route silently under-recalls on the queries users actually type.
  2. The tokenizer over-recalls on Cyrillic. On Cyrillic input jieba produces very weak tokens, and a
    query keeps returning documents that contain none of the requested terms; those hits are reported with
    matchedBy: "fts". This makes the lexical route unusable for quality control — recall cannot be
    trusted because precision is not bounded.

Both were confirmed at engine level (raw SDK, no wrapper), so this is the schema choice, not an
integration issue. A third observation compounds it: the effective FTS schema is not persisted. In the
Rust workspace IndexDescriptor.fts is annotated #[serde(skip)] and is re-materialised from the constant
on deserialization, and the published manifest.json carries embedding information only. An index
therefore cannot tell which tokenizer it was built with, while the embedding model is stored and
validated — [EMBEDDING_MODEL_MISMATCH] proves the mechanism exists.

This affects any morphologically rich language, i.e. any workspace where documents rather
than source code are the primary corpus. It is also the same root cause as #324 and #325: #324 reports
that the relevant helper ranks 246, outside the top-200 lexical candidate budget, on English morphology
alone — a candidate-budget symptom of an unnormalised lexical representation, which is an independent
confirmation that the analysis chain, not the ranking, is the bottleneck.

Reproduction. Create three documents and index them:

docs/a.md:  Архитектурное требование стандарта согласовано.
docs/b.md:  Согласование архитектурных требований занимает время.
docs/c.md:  The quick brown fox jumps over the lazy dog.
zg index "$PWD" -g "**/*.md" --reset-paths
zg query --fts "архитектурное требование" --mode direct      # expected: both RU docs
zg query --fts "архитектурных требований" --mode direct      # expected: both RU docs
zg query --fts "гипотетический фибуляториум" --mode direct   # expected: hits: 0

Expected: #1 returns a.md and b.md, not the English c.md; #3 returns hits: 0.
Actual: #1 and #3 both return all three documents, marked matchedBy: "fts", at rank 1–3 of 3.
Replacing only the schema (standard + ["lowercase","stemmer"] + {"stemmer_lang":"russian"}) and
rebuilding the same tree makes #1 return the two Russian documents and #3 return hits: 0 (verified:
0.2.2, --mode direct). The query must span two words, and both variants of one lemma are matched by the
current schema through the shared word — the usable control is the invented term, not a single word.

Proposed Solution

Expose the whole FTS analysis chain with the precedence the project already uses for embeddings
(--embedding > ZVEC_GREP_EMBEDDING > global config > built-in default, see src/cli/help.ts):

# new indexes only; values are validated against what the engine accepts
zg index "<root>" --fts-tokenizer standard --fts-filters lowercase,stemmer --fts-stemmer-lang russian
ZVEC_GREP_FTS_TOKENIZER=standard ZVEC_GREP_FTS_FILTERS=lowercase,stemmer ZVEC_GREP_FTS_STEMMER_LANG=russian zg --index
zg config set fts.tokenizer standard    # optional third level of the same chain

This is deliberately a primitive rather than a per-language feature flag: with the same three knobs it
also expresses what #324 asks for (English stemmer_lang: english) and gives #325 a place to live
(an identifier-splitting filter in the same chain), so one mechanism can close three tickets instead of
accumulating three special cases.

Accompanying behaviour that makes the knob usable in practice:

  1. Defaults unchanged — built-in stays tokenizer: "jieba", filters: ["lowercase"], so existing
    indexes and the CN use case are unaffected.
  2. Persist the effective schema. Put the FTS settings into the index descriptor / manifest.json
    instead of #[serde(skip)], mirroring how the embedding model is recorded, so an index is
    self-describing.
  3. Report and validate it. Populate the existing FTS tokenizer=… filters=… line in zg status
    from the descriptor rather than from the constant, and reject an index whose recorded tokenizer
    differs from the requested one with a rebuild hint, the same way [EMBEDDING_MODEL_MISMATCH] works.
  4. Document the accepted values, including which stemmer_lang values the engine really accepts — the
    language list is currently undocumented even though "russian" demonstrably works (Snowball-based,
    verified against morphological pairs, with English left untouched).
  5. Optionally sugar-coat it as a locale preset (--fts-lang ru ⇒ standard + stemmer(russian)), keeping
    the primitive flags available.

Implementation touchpoints (ordered by where the project is going — #126 is a Rust rewrite and the
published 0.3.0 platform packages are already Rust, so the Rust side is listed first):

File Change
rust/crates/zg-engine/src/domain/index.rs turn FTS_CONFIG into a resolved value carried by IndexDescriptor (drop #[serde(skip)])
rust/crates/zg-engine/src/storage/fragments/mod.rs pass the third argument of IndexParams::fts() through
rust/crates/zg-cli/src/status.rs, rust/crates/zg-daemon-protocol/src/lib.rs take the displayed tokenizer/filters from the descriptor
src/cli/args.ts, src/cli/help.ts new flags and the precedence table entry
src/engine/storage/zvec.ts (createSchema) read tokenizer / filters / extraParams from the resolved settings instead of literals
tests currently asserting the literal "jieba" (zg-engine/tests/engine_storage.rs, zg/tests/config.rs, zg-transport-mcp/src/lib.rs) parameterise

Constraint worth stating in the docs: the FTS schema is fixed when the collection is created (FTS
fields do not support alter column), so switching tokenizer always means zg index … --rebuild —
measured at ~11 minutes per 11 000-file tree, which is why reporting the active schema in zg status
matters more than the flag itself.

Related: #324 (English morphology normalization — same root cause, scoped by its author to English
only), #325 (identifier subword splitting in the same chain), #126 (Rust rewrite roadmap, which decides
which implementation should get the flag first).

Alternatives Considered

Alternative Why it is not the answer
Waiting for #324 and extending its English normalization to other languages #324 scopes itself away from this on purpose ("do not apply English stemming indiscriminately to other languages or code literals"), and stemming is only half of the problem here: on Cyrillic the loss comes from the tokenizer producing weak tokens, which no filter change can repair
Patching dist/engine/storage/zvec.js of the installed package works and is what is running today, but is silently reverted by any npm i -g @zvec/zvec-grep@…, and requires a full re-index in both directions
Building a sidecar collection with the raw zvec SDK gives full schema control, but loses hybrid fts + vector retrieval in a single query and duplicates the indexing pipeline outside the tool
External sparse-BM25 encoder (bm25-ru + dashtext) as a sparse vector dashtext is unavailable in my environment, its IDF model is trained on Wikipedia rather than on the target domain, and the upstream licence is unstated
Relying on the vector route only and ignoring --fts measurably worse than a working lexical route for exact identifiers, error strings and filenames, and hybrid fusion cannot repair a broken channel: on this corpus --fuse ranked below pure vector on all four metrics because the noisy lexical votes get equal weight in RRF
Raising max_token_length, ascii_folding, or ngram as substitutes measured: ascii_folding does not fold Cyrillic (ёлка ≠ елка); ngram at n=2/3 reproduces the same false hits as jieba (50 and 32), at n=4 it is weaker than standard

Affected Area

Search or retrieval, Indexing or file extraction, CLI, Agent or MCP integration, Documentation

Additional Context

Environment of the measurements: @zvec/zvec-grep 0.2.2, @zvec/zvec 0.7.1; local embedding model fixed
across comparisons (local/potion-code-16m-v2, 256 dims, cosine); all lexical numbers obtained through
zg query --fts --mode direct, i.e. the shipped pipeline, with synthetic controls run additionally against
the raw SDK.

Effect of changing only the schema, on a my private Russian document corpus (thousands files, 7 queries, top-5,
one ranking pass per query): relevant hits among top-5 results went from 9 to 35, false hits on invented
control terms from 50 to 0, while the carrier document of an exact phrase moved from rank 1 to rank 6 and
the mean rank over morphological pairs from 2.5 to 3.33. The last two rows are the cost of stemming and
are reported deliberately — hence the request for a configurable chain rather than for
stemmer(russian) as a new default.

Two limitations stated up front, so the numbers are read correctly: the relevant-hit counts come from a
single private corpus and 7 queries — they establish direction, not a benchmark; and stemmer_lang was
verified on a small set of morphological pairs, so the language list should be documented from the engine
source rather than from this report.

Activity

  1. added
    enhancement
    on Nov 10, 2026
  2. RudyNutbeij commented on Nov 13, 2026

    @RudyNutbeij

    It's only the keyword search, not the semantic search

    1. Any query of two or more words matches every document. The jieba tokenizer in zvec keeps the space between words as a token, and every document contains spaces. A single made-up word correctly gives 0 hits, but two made-up words return everything, all labelled matchedBy: "fts".
    2. Letters like ë and ï become separate tokens. So ideeën also matches patiënt.
  3. login4all commented on Nov 14, 2026

    @login4all
    Author

    @RudyNutbeij — thanks, both of your observations reproduced here, and both are fixed by the same change: branch fix/fts-standard-tokenizer in my fork, https://github.com/login4all/zvec-grep/tree/fix/fts-standard-tokenizer

    You were right about the mechanism. The FTS field is created with tokenizerName: "jieba". jieba is a CJK segmenter, and for everything else it does two things that break search:

    1. it keeps the space between query terms as a token, and every document contains spaces — so any two-word query matches every document, labelled matchedBy: "fts";
    2. it cuts non-CJK text into single characters, so ë is its own token and ideeën matches patiënt.

    Your two cases, on a three-file fixture (ideas.md = "De ideeën van het team…", patient.md = "De patiënt wacht…", plain.md = "Gewone tekst…"):

    query before (jieba) after (standard)
    ideeën 2 documents — ideas.md and patient.md 1 — ideas.md
    patiënt 2 documents — patient.md and ideas.md 1 — patient.md
    xyzzy 0 0
    xyzzy plugh 3 = all 0

    On a real corpus (Pro Git, Russian, 112 .asc documents, local/potion-multilingual-128m): коммит returned 110 documents where 47 contain it as a word; the non-word кккк returned 109; two non-words returned all 112. After the change: 47, 0, 0.

    How to check it on your own corpus — it is one flag and no code reading:

    git clone https://github.com/login4all/zvec-grep -b fix/fts-standard-tokenizer
    cd zvec-grep && npm ci && npm run build          # Node >= 20 (22 used here)
    node dist/cli/index.js --index --embedding local/multilingual-e5-small .
    node dist/cli/index.js --fts "ideeën" --limit 50 --preview none
    node dist/cli/index.js --fts "xyzzy plugh" --limit 50 --preview none

    Or reproduce it on a git-book: git clone --depth 1 https://github.com/progit/progit2-zh (or progit2-ru, progit2), index it the same way, and compare zg --fts "提交" with zg --fts "喵喵喵 嗡嗡嗡". On the old build the second query returns all 110 documents.

    One honest caveat for your (Dutch) case specifically: standard is a word analyzer, so a prefix is not a token — idee no longer matches ideeën. That is the expected behaviour of a word tokenizer; substring and prefix search is zg --rg, not the FTS field. If you relied on prefix matching, say so and it can be discussed as a separate flag.

    For CJK users reading this: standard splits Han text per character, so 提交 matches every document containing both characters (93 of 110 here) where jieba matched the word exactly (73). --fts-tokenizer jieba keeps the old Chinese profile; its space token still makes any two-word query match everything, which is a defect inside the analyzer. Existing indexes are not touched — the analyzer is fixed at collection creation, so nothing is rewritten until you run --rebuild.

  4. egolearner commented on Nov 18, 2026

    @egolearner
    Contributor

    Thanks @login4all and @RudyNutbeij for the reproductions and #412. I’ve updated #438 with language presets and user-defined mappings, and rebased it onto the latest main. This remains a proposed Rust implementation for discussion and review.

    The proposal:

    • Add --fts-lang to zg --config fts set for global defaults and zg --index for individual workspaces. Keep --fts-tokenizer, --fts-filter, and --fts-extra-params available for explicit overrides.
    • Provide 35 built-in language presets. zh uses jieba + lowercase; the other 34 use standard + lowercase + stemmer with the corresponding Snowball language, including English, Russian, Dutch, German, French, Spanish, Portuguese, Arabic, and Hindi. English stemming is enabled by default when selecting en.
    • Allow ~/.zvec-grep/fts-languages.json to replace built-in mappings or add custom names without changing code. Each entry supplies the complete tokenizer, filters, and extra parameters. zg --config fts langs lists effective mappings and their sources; the PR includes an example file.
    • Persist only the resolved tokenizer, filters, and extraParams, and report them through zg --status. Editing a mapping does not silently change saved global defaults or existing indexes.
    • Keep the built-in default analysis as jieba + lowercase with empty extra parameters. Global defaults apply to new indexes; existing indexes retain their saved analysis during updates and ordinary rebuilds. Changing an existing index’s analysis requires an explicit selection or FTS options together with --rebuild.

    For example:

    zg --config fts langs
    zg --config fts set --fts-lang en
    zg --index /path/to/russian-docs --rebuild --fts-lang ru

    Explicit low-level fields override the selected preset. Filters and extra parameters replace the entire list/object, including explicit empty values. To apply a changed custom mapping, repeat the selection when saving global defaults or rebuilding an index. Selecting equivalent settings does not require a rebuild.

    Selecting a standard-based preset and rebuilding addresses the reproduced whitespace and accented-word false matches. Stemming adds morphological matching, such as English running / runs, and can change exact-word precision. Presets are selected explicitly; there is no automatic language detection or per-document language routing.

    CLI direct and server modes expand presets using the caller’s mapping file before dispatch. MCP accepts ftsLang and uses the server user’s mapping file through the same resolver. Regression coverage includes native indexing, reopening, and querying for all 35 presets, English and Russian stemming, custom mappings, saved-configuration stability, and the reported false matches.

    Before merging, I’d welcome feedback on the preset choices and stemming defaults, the custom mapping format, and whether preserving saved analysis during ordinary rebuilds fits your workflows.

    @login4all and @RudyNutbeij, could you try the updated PR against your original corpora and share any remaining false matches, unexpected stemming behavior, or missing language mappings? Feedback from Chinese and mixed-language workspaces would also help assess these defaults and improve the proposal.

  5. login4all commented on Nov 18, 2026

    @login4all
    Author

    Thanks @egolearner — this is a thorough piece of work, and I ran it against real corpora before replying.

    Build: your head 1c2ee5a6 (zg 0.3.1, Rust workspace, toolchain 1.98.0, cargo build --release -p zg
    9m06s), --mode direct, local/potion-multilingual-128m. Corpora: the same Pro Git asc sets that are
    behind #387 (en 109 files, ru 112, zh 110), the three-file Dutch fixture from @RudyNutbeij, and a
    1 820-file mixed Russian/English corpus for scale. Nothing was pushed; your branch and our PR are untouched.

    One measurement note first, because it will bite anyone reproducing my numbers: Rust 0.3.1 reports
    entities (chunks), not files — коммит on the ru corpus returned 1 285 hits across 110 files. Every
    figure below is unique file paths, deduplicated from the #N path:start-end rows. That is the same unit the
    14.11 baseline used, so old and new numbers are comparable — but a plain wc -l is not.

    1. Remaining false matches: the class is still the default

    The whole point of #387 reproduces on your head with no flags at all:

    corpus query default (jieba+lowercase) --fts-lang preset
    ru (112) кккк (not a word) 109 0
    ru кккк фффф (two non-words) 112 = all 0
    en (109) xyzzy plugh 109 = all 0
    zh (110) xyzzy plugh 110 = all 110
    nl (3) xyzzy plugh 3 = all 0
    agentic (1 820) кккк 290 (16 % of the corpus) 0
    agentic кккк фффф 258 0

    And on the realistic corpus the same defect in its most damaging form — a phrase of two real words, where
    neither is rare: «агент платеж» returns 262 files, 147 of which contain neither word. The presets
    collapse all of it to 0.

    2. Presets: what they buy, and one place where they add nothing

    ru — --fts-lang ru is the right call, and stemming is most of why:

    query default --fts-lang ru standard, no stemmer ground truth (whole word)
    коммит 110 (42 FP) 48 (0) 47 (0) 47 / substring 68
    коммиты 110 (42) 64 (0) 44 (0) 44
    коммитов 110 (42) 64 (0) 48 (0) 48

    en — the English stemmer is a clean win, no precision cost:

    query default --fts-lang en standard, no stemmer ground truth
    commit 66 68 66 66
    commits 55 68 54 54
    committing 19 68 19 17

    All three queries return the same 68-file set — the union of the three forms, FP 0. That is exactly what a
    stemmer should do.

    zh — zh is byte-for-byte the default and adds nothing:

    query default --fts-lang zh standard ground truth
    提交 73 73 93 (20 FP) 73
    分支 65 65 95 (30 FP) 65
    提 1 1 92 92
    提交 分支 110 (50 FP) 110 99 (39 FP) —

    So for Chinese your preset preserves today's behaviour exactly — which is right, because standard trades
    precision for recall there (73 → 93 with 20 false documents). But it also means zh is not a fix, it is a
    no-op, and the class in section 1 survives it untouched.

    nl — the case from @RudyNutbeij, and a real inconsistency I did not expect:

    query default nl preset standard
    ideeën 2 (1 FP: patient.md) 1 (0) 1
    patiënt 1 (1 FP) 0 — not found 0 — not found
    xyzzy plugh 3 = all 0 0

    ideeën (ë) is found, patiënt (ï) is not found at all under standard. Diacritics are handled
    inconsistently, which looks like a tokenizer that sometimes keeps and sometimes drops the accented grapheme.
    For nl/de/fr/pt this needs ascii_folding or an explicitly diacritic-safe tokenizer — otherwise a
    correct word returns nothing, which is a worse failure than the noisy default it replaced.

    3. Stemming details worth knowing before anyone turns it on by default

    • English: as expected. See above.
    • Russian: unification is partial, reproducibly. коммит 48 vs коммиты = коммитов 64 — singular
      and plural do not meet for that lexeme, while ветка = ветки 62 but веток 39. Two families, same
      language, two different outcomes.
    • Derivational overmatch is the price. On the mixed corpus коммерция returns 118 files against a
      ground truth of 75
      (+43): the stemmer folds «коммерческий» and friends into it. протокол was +2
      (177 vs 175), so this is lexeme-specific rather than systematic.
    • ё-forms fold correctly: платеж and платёж return the same 156-file set under ru.
    • One preset per workspace does not cover mixed corpora. In a ru workspace English morphology is off:
      agent 321 vs agents 311, payment 245 vs payments 243. No autodetection is a defensible choice, but
      a workspace holding both languages gets unification for one of them.

    4. The one point I disagree with: the built-in default

    Everything in section 1 happens with zero flags. With jieba as the built-in default, that stays the
    behaviour for every workspace that never discovers a preset — precisely the population #387 was filed for.
    Adding 35 presets makes the fix available; it does not make it arrive.

    I would make a different choice here: standard + lowercase as the built-in default, with jieba
    behind zh, rather than presets that have to be found in order to undo the default.
    If the default has to stay, one line at index time —
    "analysis is jieba; in non-CJK corpora a two-word query matches every document" — at least turns a surprise
    into a choice. Put it next to the existing analyzer-mismatch warning; it costs a stderr line.

    5. Three things about the surfaces, from our own expensive lessons

    --fts-lang is a new knob at the same seam where our #412 failed invisibly: I parsed --fts-tokenizer,
    validated it, and silently dropped it — it was read from the service's options instead of the call's, never
    reached the direct path, and was not declared in the MCP schema. --fts-tokenizer jieba returned
    byte-identical results until all three surfaces carried it. So the test worth having is not "the key is
    declared" but "the same corpus yields different numbers under --fts-lang zh and --fts-lang en, through
    CLI direct, through the server and through MCP"
    .

    That test is already in your branch, and I ran it: server_lifecycle::fts_languages
    (fts_language_cli_expands_before_transport_and_mcp_reloads_server_mappings). At head 1c2ee5a6 it passes —
    1 passed, 5.18 s (cargo test --release -p zg --test server_lifecycle fts_language). It asserts the four
    things I would have asked for: the CLI branch expands the preset client-side in both index modes, MCP expands
    it server-side and picks up a changed mapping on the next call, an absent argument keeps the stored analysis,
    and a corrupt mapping file makes MCP refuse by name while the CLI falls back to the client config. fts_lang
    is declared on the index tool — which is the right seam: analysis is a property of the schema, not of the
    query. To be explicit about the limit of that statement: one green test is not a green branch. It is the
    evidence I have; I did not run the rest of your suite (section 6).

    The other thing I would keep from #412: on an existing index the flag should refuse out loud
    ("this applies only with --rebuild") instead of being ignored. Silent no-ops on analyzer settings are how
    false confidence gets built.

    One accident worth two tests, and it is mine, not yours. ~/.zvec-grep/config.json is shared between the
    0.2.x and 0.3.1 builds. While measuring this branch I ran --config fts set, which wrote a defaults.fts
    block; 0.2.x then refused the whole file with zvec-grep global config is invalid — naming neither the file
    nor the key — and the 0.2.x-backed tooling I use daily served nothing until I restored the file by hand. A
    newer build writing a new key should not brick an older install, and a config error should say path and key.
    Two tests: unknown keys in the global config are ignored with a warning; the error names file and key.

    6. What I did not test, and one open question

    Not tested: the rest of your suite — I ran one server_lifecycle test and nothing else, because the engine
    test set hit my 700-second timeout with the VM disk at 99 %, so I stopped instead of evicting your build
    artefacts. Also not tested: browser/desktop surfaces, and any Chinese mixed-language workspace — our Chinese
    corpus is a translation of the same book, so 73/65/1 against 93/95/92 is the whole of my evidence there.

    Open question, not a claim against your change: on the 1 820-file corpus English recall is low in both
    modes and nearly identical between them — agent finds 311 (default) / 321 (ru) of the 747 files that
    contain it. A 10-file difference between modes says this is not an effect of #438; my guess is the extractor
    or my own ground truth computed from raw HTML/JSON markup. On clean text (Pro Git .asc) recall was exact
    (66/66). If you have a corpus where English recall is known-good, that would settle it faster than I can.

    I would rather see one implementation in the engine than two flags competing for the same job —
    if #438 lands with a default that does not reintroduce the false matches, #412 has done its work and can be
    closed.

  6. egolearner commented on Nov 24, 2026

    @egolearner
    Contributor

    @login4all, thanks for testing this on the Pro Git corpora and for counting distinct files. Your comparison of 提交 under Jieba and standard helped clarify the trade-off. I’ve made two changes in response.

    New workspaces now default to standard + lowercase in #438. If you set only filters or extra parameters, the tokenizer comes from your global configuration, falling back to standard. Stemming is opt-in through a preset such as --fts-lang en or --fts-lang ru. For Chinese workspaces, --fts-lang zh selects jieba + lowercase and preserves word-level matches like 提交.

    The Jieba whitespace bug also has a fix in the open zvec PR #918. It filters whitespace-only tokens in all four Jieba modes. With the patch, xyzzy plugh returns zero hits against hello world, while hello plugh still matches. Once a zg build includes the fix, existing Jieba indexes benefit on the query side immediately. Rebuilding also updates stored token positions and BM25 document lengths. I’ve asked the cppjieba maintainers whether they recommend filtering in the caller or would accept an option upstream. cppjieba issue #247

    Existing workspaces keep their saved analyzer, including on a plain --rebuild. To try the new default on an existing Pro Git index built with the old defaults, run zg --index /path/to/progit --rebuild --fts-tokenizer standard --fts-filter lowercase. This also lets you test alongside 0.2.x without writing defaults.fts to the shared global config.

    One result I’d still like to understand is patiënt. Our three-document regression with standard + lowercase gets one hit for ideeën, one for patiënt, and zero for xyzzy plugh. Could you share the exact contents of patient.md and the command that returned zero? That would let us reproduce the discrepancy before deciding whether ascii_folding would help. Regression test

  7. self-assigned this
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions