Posted on 17/08/2026 16:15:11
Hi,
Good catch, and useful detail that it works without spaces but not with them — that pointed straight at where the multi-word synonym lookup breaks. I checked the actual implementation (this isn't Lucene's stock SynonymFilter/SynonymMap, Dynamicweb has its own).
Short answer: no, there's no config-based character filter or pattern-replace step available. The SynonymAnalyzer pipeline supports exactly four tokenizers — Standard, LowerCase, Whitespace, Keyword — and there is no character-filter concept (no MappingCharFilter, PatternReplaceCharFilter, or anything pre-tokenization) anywhere in the indexing provider. So there's no XML/backend knob to normalize "15 x 21" before it gets tokenized.
But that's not actually why your multi-word synonym is failing. The Whitespace tokenizer splitting "15 x 21" into ["15","x","21"] isn't the problem by itself — Dynamicweb's synonym engine is specifically built to walk multi-token sequences back together and match them against multi-word synonym entries. Both indexing and querying go through the same analyzer, so the token stream shape is consistent on both sides. The real bug is a case-folding mismatch between the two halves of the pipeline:
The filter chain order for the Whitespace tokenizer is: WhitespaceTokenizer → LowerCaseFilter → (optional StopFilter) → SynonymFilter. So by the time your tokens reach the synonym lookup, they're already lower-cased.
But the synonym dictionary itself is built by SynonymEngine.LoadXmlDocument, which reads each <synonym> entry with synNode.InnerText.Trim() — no lower-casing at all. The multi-word keys it stores in its lookup dictionary are built verbatim from your XML text, case and all.
So if your <synonym> entry is written as 15 x 21 with a lowercase x, it should actually match fine against a 15 x 21 query. But if it's written with any uppercase character anywhere in it — e.g. 15 X 21, or casing anywhere else in that phrase — the dictionary key won't match the lower-cased runtime tokens, and the multi-word walk in SynonymFilter silently falls through (GetStem just returns "not found," there's no logging). Single-word entries can appear to work by coincidence if they happen to already be lowercase, or because a single token still gets some partial matching behavior — but the moment a multi-word phrase key has any case mismatch, the whole phrase-walk fails from the first token.
What to check/try, no code change needed:
Open your synonym XML source and verify every character in every multi-word <synonym> entry is lowercase — including entries like 15 x 21, not 15 X 21.
Double-check for stray extra whitespace in the XML entry itself (tabs, double spaces, non-breaking spaces from copy-paste) — the engine splits strictly on ' ' and rebuilds with single spaces, so "15 x 21" (double space) or a non-breaking space won't match a normal "15 x 21" query either, and this one isn't fixable by casing.
If your stem attribute or other entries in the same group mix case intentionally (e.g. a product code that's meant to stay uppercase), that's fine — it's specifically the literal text of the <synonym> phrase itself that needs to be all-lowercase to survive the LowerCaseFilter step before matching.
If lowercasing the XML source fixes it, that confirms the mechanism. If it's still not matching after that, it's worth sending over the exact <group> XML block so we can check for whitespace/encoding issues in the file itself.
There genuinely isn't a config-based char-filter/pattern-replace mechanism in this analyzer today — if normalizing punctuation (like your 1/2" example) or other formatting variants turns out to be a recurring need beyond just casing, that would need either a custom field-value processing step at index/query time, or would be worth raising as a feature request for the analyzer pipeline.