Skip to content

Refactor: vector_similarity_weight -> keywords_similarity_weight - #20385

Merged
yuzhichang merged 1 commit into
infiniflow:mainfrom
wangq8:use-keyword-similarity-weight-as-major-1
Sep 29, 2026
Merged

yuzhichang merged 1 commit into
infiniflow:mainfrom
wangq8:use-keyword-similarity-weight-as-major-1

Conversation

@wangq8

@wangq8 wangq8 commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Test: passed.

@wangq8 wangq8 added the ci Continue Integration label Sep 29, 2026
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: cdb205d4-0305-4b5e-88a1-1e2da8715f15

📥 Commits

Reviewing files that changed from the base of the PR and between e0cc7ee and 4f96845.

📒 Files selected for processing (17)
  • docs/references/http_api_reference.md
  • internal/dao/kb.go
  • internal/entity/dataset.go
  • internal/handler/chat.go
  • internal/handler/search.go
  • internal/service/chat.go
  • internal/service/chat_rest_update_test.go
  • internal/service/dataset/create_test.go
  • internal/service/dataset/list_test.go
  • internal/service/dataset/utils.go
  • internal/service/search.go
  • internal/service/search_test.go
  • web/src/interfaces/database/chat.ts
  • web/src/interfaces/database/dataset.ts
  • web/src/pages/next-chats/chat/app-settings/chat-settings.tsx
  • web/src/pages/next-search/search-setting.tsx
  • web/src/pages/next-searches/hooks.ts
💤 Files with no reviewable changes (3)
  • internal/handler/chat.go
  • web/src/pages/next-searches/hooks.ts
  • web/src/interfaces/database/chat.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Dataset, chat, and search responses now expose keywords_similarity_weight instead of vector_similarity_weight. Dataset mappings include similarity_threshold. Web interfaces and settings, API examples, and tests are updated to reflect these response fields.

Changes

Similarity Weight Response Contract

Layer / File(s) Summary
Dataset response fields
internal/dao/kb.go, internal/entity/dataset.go, internal/service/dataset/*, docs/references/http_api_reference.md
Dataset mappings include similarity_threshold and derive keywords_similarity_weight from the stored vector weight. Tests and dataset response examples check or show the keyword field.
Chat response fields
internal/handler/chat.go, internal/service/chat.go, internal/service/chat_rest_update_test.go, docs/references/http_api_reference.md
Chat responses expose the keyword weight and omit the vector weight. The REST response also omits similarity_threshold. Tests and chat response examples reflect these fields.
Search configuration responses
internal/handler/search.go, internal/service/search.go, internal/service/search_test.go
Search responses use BuildSearchConfigResponse, which copies the configuration, derives the keyword weight when absent, and removes the vector weight.
Web types and form defaults
web/src/interfaces/database/*, web/src/pages/next-chats/chat/app-settings/chat-settings.tsx, web/src/pages/next-search/search-setting.tsx, web/src/pages/next-searches/hooks.ts
Web types no longer declare the vector weight. Chat and search settings use 0.7 as the default keyword weight when its saved value is nullish.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Suggested reviewers: euvre, buua436

Merge Risk: ⚪ Minimal · up to 4f968

No actionable issue is established in the updated similarity-weight responses or web defaults; the change is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 4f968

The field change reaches several public responses. One valid search update can leave the displayed keyword weight inconsistent with the weight used for retrieval. The reviewed paths do not show a wider data-access boundary, but compatibility and deployment behavior remain uncertain.

Retained concerns

  • Low · architecture · inferred: An authorized search update containing a null keyword weight can produce a response that reports null while retrieval continues to use the stored vector weight. Removing the vector field from the response makes that effective setting unavailable through the new public representation.
Security review details

Security Blast Radius

  • inferred — The identified null-weight divergence is reachable through an authorized search-configuration update and affects that search's reported retrieval setting. The inspected paths do not show it granting access to another tenant or changing service privileges.

Trust Boundaries and Controls

  • observed — Search update checks creator authorization before saving configuration. The share-detail response conversion follows API-token authentication and a tenant-membership access check; the conversion does not add a separate data lookup.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 13 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description only states that tests passed. It does not include the required Summary section or explain the purpose and background of the change. Add a Summary section that briefly describes the refactor, explains why keywords_similarity_weight replaces vector_similarity_weight, and retains the test result.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change from vector_similarity_weight to keywords_similarity_weight.
Full details: Docstring Coverage

Explanation

Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 13 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the fields at dawn,
The vector label hops along.
A keyword weight lands at point seven,
The dataset rows line up in heaven.
Chat and search now share the tune,
Then bunny bounds beneath the moon.

Comment @coderabbitai help to get the list of available commands.

@yuzhichang
yuzhichang merged commit f03ee77 into infiniflow:main Sep 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants