TengenceTengence
Product docs

Query Understanding Configuration

Configure tokenization, stop words, spell correction, synonyms, named entity recognition, term weights and category prediction, and understand their processing…

Query understanding is the first stage of the search pipeline. Before a query reaches recall and ranking, it is normalized, tokenized, corrected and expanded. Tokenization, stop words, spell correction, synonyms, named entity recognition, term weight and category prediction all happen here.

These settings change how a query is interpreted. They do not change the index or the page. A saved rule applies to new requests without rebuilding the index.

The seven modules

Module What it solves What you configure What happens on a match
Tokenization The tokenizer splits a business term incorrectly, or several tokens should be one term Source text + token sequence A matching query segment is split into the configured tokens
Stop Words Remove noise words, or force-keep a word the system would drop One word per line Enabled removes the word from later stages; Disabled forces it to stay
Spell Correction A misspelling or variant should map to the approved form Term to correct + corrected term The query is rewritten first, then tokenized again
Synonyms One product has several names and all should be recalled Term + several synonyms Matching terms add the synonyms to the recall expression
Named Entity Recognition Tag brands, colors, sizes, materials and similar entities Term + entity type The term gets an entity label for downstream ranking and filtering
Term Weight A term should matter more or less in ranking Query term + weight from 0.0 to 1.0 Overrides the default weight for that term
Category Prediction A query term should map to a product category Query term + category + relevance Token matches produce a category ID and name

Each module has its own rule table. All seven pages share the same layout: an Operation Configuration tab, a rule list, keyword and date filters, bulk enable/disable/delete actions, and Debug and Add Rule on the right. There is no module-level switch; each rule is enabled or disabled on its own.

Where to configure

In the console, open Tengence Search → Query Understanding and choose a module. The routes are:

  • Tokenization: /search/query-processor/tokenize
  • Stop Words: /search/query-processor/stop-word
  • Spell Correction: /search/query-processor/spellcheck
  • Synonyms: /search/query-processor/synonym
  • Named Entity Recognition: /search/query-processor/ner
  • Term Weight: /search/query-processor/term-weight
  • Category Prediction: /search/query-processor/category-prediction

Append the current app’s appId, for example /search/query-processor/tokenize?appId=11942244.

In some console versions, Term Weight is not linked from the left navigation even though the page and its configuration are available. If you cannot see it in the menu, open the route above directly. Whether it appears in the menu depends on your console version.

Rules created in the console are manual rules. A manual rule is created as Approved + Enabled and joins the effective set immediately; no separate review is required. The rule table shows enabled status. To take a rule out of service temporarily, disable it instead of deleting it.

The list supports keyword search, creation and update date filters, and multi-select bulk enable, disable or delete. Deleting a rule removes it from query processing. If you only need to pause it, disable it and keep the configuration for later.

Tokenization

Tokenization rules correct the tokenizer’s output. A typical case is a business term split into meaningless pieces, such as “phone case” being split into “phone” and “case” when the catalog uses the compound as one term.

The form has two steps:

  1. In Add Rule, enter the source text, up to 500 characters. The console returns the system tokenization.
  2. Select the spans that should become individual terms. The tags below the text are the final token sequence.
Tengence console Add Rule drawer showing the tokenization result for the sample query
Tokenization rule: confirm the split result

Three constraints apply:

  • Every character in the source text must belong to a tag. If a span is left unassigned, the page warns you and blocks the save.
  • Tags cannot overlap. To change an existing split, remove the unwanted tags first, then select the new spans.
  • The source text can be up to 32 characters; the joined token sequence can be up to 100 characters.

After saving, every occurrence of the source text in a query is replaced with the configured token sequence. If several rules match the same text, the longer match wins; at equal length, the manual rule wins.

Tokenization rules affect query-side analysis only. They do not rewrite documents already in the index. The index is built with the platform’s tokenization granularity, so a query that is split differently may not match a document token. After configuring a rule, verify recall with real queries, not just the tokenization result.

Stop Words

Stop words support two opposite operations:

  • Remove: drop words such as “the”, “a” or “please” that add no search value, reducing irrelevant recall.
  • Keep: preserve a word that the system would normally drop but that your business needs in search.

Paste the words into the text box, one per line. Blank lines are ignored. Do not separate words with commas; a comma-separated line is treated as one word. Select Next to preview the words as tags, then save.

The platform ships a general stop-word list covering common Chinese and English function words. Manual rules take precedence:

  • Enabled: the word is always removed, even if the system list would keep it.
  • Disabled: the word is always kept, even if the system list would remove it.

Stop-word filtering runs after tokenization and before NER, synonym expansion, term weighting and category prediction. Once a word is removed, it cannot receive an entity type, synonyms, a weight or a category. Do not put core product modifiers such as brand, color, specification or model into the stop-word list; doing so removes that information from every later stage.

Spell Correction

Spell correction maps a misspelling or variant to the term your catalog uses. For example, “wireles charger” can be corrected to “wireless charger”.

Enter the term to correct and press Enter. The page checks whether an effective rule already exists. If it does, the existing corrected term is shown; if not, enter the corrected term directly. After saving, a query containing the original term is rewritten before tokenization.

The platform does not ship a general-purpose correction dictionary. Correction coverage is exactly the set of term pairs in the rule table. A misspelling without a rule is left unchanged. If you expect automatic correction of arbitrary typos, add the pairs you care about; the platform will not infer them.

Correction runs before tokenization. When a rule matches, the corrected text is tokenized again and then goes through stop words, NER and the remaining stages. If the same span matches both a correction rule and a tokenization rule, correction runs first and the tokenization rule no longer applies to the original text. Do not configure both rule types on the same span.

Synonyms

Synonyms let several names share recall. For example, “dress”, “frock” and “gown” may need to retrieve the same products.

Enter a term and press Enter. The platform returns built-in synonyms and shows them as existing synonyms. Remove the ones you do not want, add your own, and save. The rule stores the union of the built-in terms left on the page and your new terms, de-duplicated.

This means the saved rule contains every synonym still on the page, not only the ones you typed. If a built-in candidate is a poor match, remove it before saving; otherwise it becomes part of the rule.

Once a manual synonym rule is effective, the platform uses the rule’s synonym list for that term and no longer uses the built-in expansion. You own the content: include only terms that are genuinely interchangeable. Do not mix broader terms, narrower terms or related products, or unrelated items will enter recall.

Synonyms are resolved after stop-word filtering. A term removed as a stop word will not be expanded. Confirm that a term survives stop-word filtering before configuring its synonyms.

Named Entity Recognition

Named Entity Recognition (NER) assigns a type label to a query term for downstream ranking, filtering and business logic. Common types include brand, color, material, size, capacity, price, model, weight and dimensions, as well as person, location and organization names.

Enter a term and press Enter. The console shows the entity type recognized by the platform; select or confirm a type from the drop-down. The list of available types is provided by the platform and may vary by app; use the values shown on the page.

The default recognizer falls back through several engines: commerce dictionary, general dictionary, HanLP and regular-expression rules. A manual rule takes precedence. Once a term has a manual entity type, that type is used instead of the engine’s judgment.

NER does not rewrite the query or add or remove tokens. It produces a label, and whether that label affects results depends on how recall and ranking consume it. After configuring a rule, check the entity type in the Query Understanding tab of Debug rather than expecting the query text to change.

If the entity-type drop-down is empty, confirm that the app’s industry and entity-type configuration is initialized. A manual rule cannot be saved without an available type.

Term Weight

Term Weight adjusts how much a single term contributes to ranking. The platform assigns a default weight based on position, length and other factors; a manual rule overrides the weight for the matching term only and leaves other terms unchanged.

Enter the query term and a weight from 0.0 to 1.0. The step is 0.01 and the value keeps two decimals. A higher weight makes the term more important in ranking; a lower weight reduces its influence.

Typical uses:

  • Make brand and model terms more important than generic category terms.
  • Suppress a modifier that should not dominate ranking for your business.
  • Distinguish the core product term from a scenario or style term in the same query.

Term Weight applies only to a term that survives tokenization. If the term is removed as a stop word, or rewritten by spell correction, the original term’s weight rule will not match. Use Debug to confirm the final form of the term before configuring a weight.

In the current console version, Term Weight may not appear in the left navigation. Open /search/query-processor/term-weight?appId=<app-id> directly. If the page is unavailable, the capability is not enabled in this version.

Category Prediction

Category Prediction maps query terms to categories already connected to the app. It does not tokenize or rewrite the query; it returns a category ID, category name and relevance level.

You can add several rules at once. Each rule has one query term and one or more category + relevance pairs:

  • HIGH: strongly related; the query term usually belongs to this category.
  • MEDIUM: related; a valid candidate category.
  • LOW: weakly related; a fallback when no stronger category applies.

When editing an existing rule, the query term is fixed; only the category list and relevance levels can be changed. To change the term, delete the rule and create a new one.

At query time, each token in the tokenized query is matched against the rule’s query term; only an exact match counts. If several rules match, the highest relevance wins for each matched term: HIGH over MEDIUM, then MEDIUM over LOW. At the same level, the first category in the rule wins.

Categories come from the app’s category data. If the drop-down is empty, connect the category data or finish index configuration first. Do not enter a category ID that the app does not contain.

A manual category rule takes precedence over an algorithm rule. If both exist for the same term, the manual rule is used even when the algorithm rule has a higher relevance level.

Processing order and interactions

A query passes through the following stages:

  1. Normalization: full-width to half-width, case normalization, trim.
  2. Spell correction + tokenization: correction rules run first; the corrected text is tokenized. Tokenization rules apply in this stage.
  3. Cross-script expansion (optional): if the app enables simplified/traditional Chinese expansion, a simplified term also gets its traditional form, and vice versa.
  4. Stop-word filtering: remove terms using the system list and manual rules.
  5. Named entity recognition: tag the remaining terms.
  6. Synonym lookup: retrieve synonyms for the remaining terms.
  7. Term weighting and category prediction: compute weights, then match category rules against the tokenized query.

The order creates several interactions to watch:

  • Stop-word filtering comes first. A removed term cannot receive an entity type, synonyms, a weight or a category. Do not put business terms on the stop-word list.
  • Spell correction precedes tokenization. When the same span matches both, only correction runs; the tokenization rule does not apply to the original text.
  • Synonyms are resolved after stop-word filtering. They expand the recall expression; they are not added back to the token stream and do not trigger a second NER pass.
  • Category Prediction matches tokens that remain after stop-word filtering. The rule term must equal one token exactly; substring matches do not count.
  • With cross-script expansion enabled, one term can enter later stages in both simplified and traditional forms, producing two weights or two category results for the same concept.

Rule status and precedence

Rules created in the console are manual rules and start as Approved + Enabled. Algorithm-generated rules start as Not approved + Disabled and do not affect queries until a person approves and enables them.

Only rules that are both Approved and Enabled enter the effective set. The rule table shows enabled status; a manual rule is already approved when saved, so Enabled means it participates in queries.

When multiple rules apply to the same term or span:

  • Manual rules take precedence over algorithm rules.
  • Tokenization uses the longest match; at equal length, the manual rule wins.
  • Manual category rules win even when an algorithm rule has a higher relevance level.
  • Synonyms, NER, spell correction and term weight match terms exactly, and a manual rule overrides an algorithm result for the same term.

Rules are applied at query time. A saved change applies to new requests immediately, does not require an index rebuild and does not alter results already returned.

Debug and verification

Every module page has a Debug button in the upper right. It opens on the Query Understanding tab, where you can enter a query and send a request to inspect every stage.

Tengence console Debug drawer with the Query Understanding tab showing term weights, synonyms, normalized query and token count
Debug panel: query understanding result

The Debug drawer has six tabs:

  • Request Body: the request parameters.
  • Response Body: the full search response.
  • Query Understanding: normalized query, token count, term weights, synonyms, entities and other intermediate results.
  • Recall: recall-stage information.
  • Ranking: ranking-stage information.
  • Reranking: reranking-stage information.

The detail object under Query Understanding contains only the stages that actually produced a result. A module with no match may have no corresponding field; for example, category results do not appear when no category rule applies. Common fields include:

  • originalQuery: the raw input.
  • normalizedQuery: the normalized query.
  • processedQuery: the query after correction and similar processing.
  • tokenCount: the number of tokens.
  • termWeighting: terms and their weights.
  • synonyms: terms and their synonyms.
  • ner: terms and their entity types.

When a rule matches, its stage carries the rule ID, matched term and applied value. Use those fields to tell whether the rule failed to match or matched but was not consumed later.

Verify each module separately:

  1. Tokenization: the matching source text is split into the configured tokens.
  2. Stop Words: a removed term disappears from later stages; a force-kept term remains.
  3. Spell Correction: processedQuery contains the corrected form.
  4. Synonyms: the configured terms appear in synonyms.
  5. NER: ner shows the configured type.
  6. Term Weight: termWeighting shows the overridden weight.
  7. Category Prediction: the expected categoryId and category name are returned.

The Debug drawer displays the app’s API key. Mask it before taking a screenshot or recording; do not put the key into tickets, chat groups or public documents.

Common issues

A rule is saved but the query does not change

Confirm that the rule is enabled. Check that the query term matches exactly: full-width versus half-width characters, case and leading or trailing spaces all matter. Then check whether the term was removed as a stop word or rewritten by spell correction; later rules cannot match after either change.

A tokenization rule and a spell correction rule are both configured, but only one takes effect

This follows the processing order. Correction runs first. When it matches, the corrected text is tokenized again and the tokenization rule no longer applies to the original text. Put the two rule types on different spans, or keep only one.

Saving a synonym rule adds terms that were not configured

The page first shows built-in synonyms, and the saved rule includes every synonym left on the page plus the terms you typed. Remove unwanted built-in terms before saving, keeping only genuinely interchangeable expressions.

Category Prediction does not match

Category rules match tokens exactly, not substrings. Confirm that the rule term equals one of the tokens counted by tokenCount. If the term is split into several tokens, the rule will not match. Also confirm that the category comes from the current app; an external category ID entered by hand is not valid.

Term Weight is configured but ranking barely changes

Confirm that the term still exists after tokenization and was not removed as a stop word or rewritten by correction. Weight is one input to ranking, and other features still affect the final order. To isolate the effect, compare termWeighting before and after the change in Debug.

Where is the Term Weight page

Some console versions do not link it from the Query Understanding menu. Open /search/query-processor/term-weight?appId=<app-id> directly. If the page is unavailable, the capability is not enabled in that version.

Related documentation

On this page