feat: Associate boost factor data with a session id #2124
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows multiple jobs / sessions to be using the index concurrently, applying different boost factors according to their needs.
Requirements
When searching for code and files, add a session id for the boost records.
When searching, the session id is a required argument, and it is used to select only the boost
records that are relevant to the current search session.
/include=search/src
Plan changes only in packages/search/src
Navie Plan
Add session id to search boost records in packages/search
Problem
The search system needs to differentiate between boost records from different search sessions to ensure boost records only affect search results within their intended context. This change should be implemented within the
packages/search/src
directory.Analysis
We need to modify the file index and search functionality to support session-specific boost records. This involves:
The core changes will be in the FileIndex class, which manages the SQLite database tables for file content and boost records.
Proposed Changes
packages/search/src/file-index.ts
:file_boost
table schema to include asession_id
columnboostFile
method to require a session id parameterpackages/search/src/types.ts
(new file):packages/search/src/snippet-index.ts
:packages/search/src/index.ts
:This implementation focuses exclusively on the search package and maintains its core functionality while adding session-specific boost capabilities.
Review
✅ Logical Changes
The changes introduce a session ID to associate boost factors with specific search sessions, ensuring that boosts are session-specific and do not interfere with other sessions. Additionally, the database schema for boost tables is modified to include session_id as part of the primary key, and tests are updated to reflect these changes. Documentation is also added to explain the purpose of the session ID.
✅ Possible Bugs to Investigate
Notes
The initial review called out the lack of documentation for the session id feature.