Skip to content

fix: avoid ZeroDivisionError when fulltext column weights sum to zero#12856

Merged
KevinHuSh merged 1 commit intoinfiniflow:mainfrom
sharpenteeth:fix/ob-conn-fulltext-weight-sum-zerodiv
Jan 28, 2026
Merged

fix: avoid ZeroDivisionError when fulltext column weights sum to zero#12856
KevinHuSh merged 1 commit intoinfiniflow:mainfrom
sharpenteeth:fix/ob-conn-fulltext-weight-sum-zerodiv

Conversation

@sharpenteeth
Copy link
Contributor

@sharpenteeth sharpenteeth commented Jan 27, 2026

What problem does this PR solve?

When all fulltext_search_columns use explicit weight 0 (e.g. "col^0"), weight_sum is 0 and dividing by it raises ZeroDivisionError. Use equal weights 1/n when weight_sum <= 0 and n > 0; otherwise normalize as before.

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Documentation Update
  • Refactoring

…m to zero

When all fulltext_search_columns use explicit weight 0 (e.g. "col^0"),
weight_sum is 0 and dividing by it raises ZeroDivisionError. Use equal
weights 1/n when weight_sum <= 0 and n > 0; otherwise normalize as before.
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Jan 27, 2026
@KevinHuSh KevinHuSh added the ci Continue Integration label Jan 28, 2026
@KevinHuSh KevinHuSh marked this pull request as draft January 28, 2026 01:51
@KevinHuSh KevinHuSh marked this pull request as ready for review January 28, 2026 01:51
@dosubot dosubot bot added the 💞 feature Feature request, pull request that fullfill a new feature. label Jan 28, 2026
@KevinHuSh KevinHuSh merged commit 15a5349 into infiniflow:main Jan 28, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration 💞 feature Feature request, pull request that fullfill a new feature. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants