**feat(search): enhance JSON document search with field-level filtering and prioritization**
- Added support for field-specific and prioritized searches in `brainyData`: - Introduced `searchField` option to enable targeted field-level searches. - Implemented `priorityFields` option for weighted vectorization and query relevance. - Developed utilities in `jsonProcessing.ts` and `fieldNameTracking.ts`: - `extractTextFromJson` for text extraction with customizable depth and field prioritization. - `extractFieldFromJson` to target specific fields in JSON documents. - `prepareJsonForVectorization` for optimized JSON vectorization. - Enhanced management of field names and mappings: - Integrated `trackFieldNames` to associate fields with their services. - Supported cross-service consistency through `standardFieldMappings`. - Updated documentation: - Added detailed guides for JSON search enhancements and HNSW limitations. - Extended usage examples in `README.md` and `json-search-test.js`. - Verified improvements with comprehensive tests: - Created unit and integration tests demonstrating search behavior improvements. - Addressed previous TypeScript errors related to search parameters. **Purpose**: Improve search accuracy and usability when working with complex JSON documents by enabling field-specific searches and enhancing contextual relevance.
This commit is contained in:
parent
81d32e0662
commit
f86295eab8
11 changed files with 1088 additions and 10 deletions
17
changes-summary.md
Normal file
17
changes-summary.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Changes Made to Fix TypeScript Error
|
||||
|
||||
## Issue
|
||||
TypeScript error in `src/brainyData.ts` at line 4339:
|
||||
```
|
||||
Object literal may only specify known properties, and 'searchField' does not exist in type '{ forceEmbed?: boolean | undefined; nounTypes?: string[] | undefined; includeVerbs?: boolean | undefined; searchMode?: "local" | "remote" | "combined" | undefined; searchVerbs?: boolean | undefined; verbTypes?: string[] | undefined; searchConnectedNouns?: boolean | undefined; verbDirection?: "outgoing" | ... 2 more ...'.
|
||||
```
|
||||
|
||||
## Changes Made
|
||||
1. Added the `searchField` property to the options parameter in the main `search` method
|
||||
2. Added the `searchField` property to the options parameter in the `searchRemote` method
|
||||
3. Added the `searchField` property to the options parameter in the `searchCombined` method
|
||||
|
||||
## Verification
|
||||
- TypeScript type checking with `npx tsc --noEmit` completed without errors
|
||||
- Build process with `npm run build` completed successfully without the previous error
|
||||
- All tests passed with `npm test`, confirming that our changes didn't break existing functionality
|
||||
Loading…
Add table
Add a link
Reference in a new issue