Repository navigation
Commit 128e3d8
committed
fix(rst): a section's text no longer reads an unwritten byte
rst_body cut a reST section's text at 500 bytes by setting a stop value
past the end, then backing off from out[RST_BODY_MAX] while that byte
looked like a UTF-8 continuation byte. That byte was never written, so
where the text ended (499 or 500 bytes) depended on what the arena memory
held, and when a multibyte character did not fit, bytes never written
could end up in the text.
Only whole characters are written now, and the text ends at the last one
written. The same django tree indexed twice gave doc_link_candidates rows
that differed in about 250 of 11,300 (through the section text's TF-IDF);
with this change two runs are identical, and so are the 6,594 sections.
The new test pins the cut at the boundary: a word that fills the 500 bytes,
a two-byte character that would cross them, a word cut at a character.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>1 parent c1cb70e commit 128e3d8
2 files changed
Lines changed: 44 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1606 | 1606 | | |
1607 | 1607 | | |
1608 | 1608 | | |
1609 | | - | |
| 1609 | + | |
| 1610 | + | |
1610 | 1611 | | |
1611 | 1612 | | |
1612 | 1613 | | |
1613 | | - | |
| 1614 | + | |
1614 | 1615 | | |
1615 | 1616 | | |
1616 | 1617 | | |
1617 | 1618 | | |
1618 | 1619 | | |
1619 | 1620 | | |
1620 | | - | |
| 1621 | + | |
1621 | 1622 | | |
1622 | 1623 | | |
1623 | 1624 | | |
| |||
1626 | 1627 | | |
1627 | 1628 | | |
1628 | 1629 | | |
1629 | | - | |
| 1630 | + | |
1630 | 1631 | | |
1631 | 1632 | | |
1632 | 1633 | | |
| |||
1635 | 1636 | | |
1636 | 1637 | | |
1637 | 1638 | | |
1638 | | - | |
1639 | | - | |
1640 | | - | |
1641 | | - | |
1642 | | - | |
1643 | | - | |
1644 | 1639 | | |
1645 | 1640 | | |
1646 | 1641 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
561 | 599 | | |
562 | 600 | | |
563 | 601 | | |
| 602 | + | |
564 | 603 | | |
565 | 604 | | |
566 | 605 | | |
| |||
0 commit comments