Files
qdrant/lib/segment
qdrant-cloud-bot 570546c23e Fix phrase matching crossing string-array element boundaries (#8938)
* Fix phrase matching crossing string-array element boundaries

When indexing a string array like ["quick", "brown"], the index
concatenated tokens from all elements into a single flat document.
A phrase query for "quick brown" found the tokens consecutively,
producing false matches.

Insert a sentinel token ("\x00") between array elements during
indexing. It is registered as a normal vocab token that occupies a
position in the document, so phrase windows cannot span it. No
tokenizer ever produces this string, so it never appears in a query.

Closes #8937

Co-authored-by: Cursor <cursoragent@cursor.com>

* Strip null bytes from tokenizer output

Ensure no tokenizer can produce tokens containing '\0', which is
reserved as the array-boundary sentinel for phrase matching.

Covers all tokenizer paths:
- process_token_cow (used by Word, Whitespace, Prefix, Multilingual)
- Japanese tokenizer (has its own inline processing)

Co-authored-by: Cursor <cursoragent@cursor.com>

* Revert "Strip null bytes from tokenizer output"

This reverts commit fe6ea7a955.

* filter sentinel token from query

* Preallocate vector

Co-authored-by: Tim Visée <tim+github@visee.me>

---------

Co-authored-by: Cursor Agent <agent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: generall <andrey@vasnetsov.com>
Co-authored-by: Tim Visée <tim+github@visee.me>
2026-05-08 16:14:23 +02:00
..
2024-06-21 23:35:19 +02:00