Skip to content

fix(fts): skip whitespace-only Jieba tokens - #918

Open
egolearner wants to merge 1 commit into
alibaba:mainfrom
egolearner:fix/jieba-whitespace-tokens
Open

egolearner wants to merge 1 commit into
alibaba:mainfrom
egolearner:fix/jieba-whitespace-tokens

Conversation

@egolearner

Copy link
Copy Markdown
Collaborator

What changed

With a Jieba-indexed document containing hello world, the default OR query match_string="xyzzy plugh" returned the document because both the document and the query contained a searchable space.

Skip empty and Unicode whitespace-only tokens in the shared output path for all four Jieba cut modes. Retained tokens keep their original byte offsets and receive consecutive positions.

Existing indexes

Upgrading the query side removes the whitespace match from OR queries against existing indexes. Rebuild affected Jieba indexes to update stored phrase positions and BM25 document lengths.

Verification

  • Reproduced the false positive before the fix. The same query now returns zero hits, and hello plugh still matches hello world.
  • Checked ASCII and Unicode whitespace, punctuation, byte offsets, and positions in search, mix, full, and HMM modes.
  • All 117 tests in jieba_tokenizer_test, fts_query_test, and fts_column_indexer_test passed on macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant