**feat(docs): add comprehensive Search and Metadata Guide with metadata handling updates**
- **Documentation Additions**:
- Introduced `SEARCH_AND_METADATA_GUIDE.md` to provide an in-depth guide on Brainy's search and metadata retrieval system:
- Detailed explanation of search workflows, metadata structures (`GraphNoun`, `GraphVerb`), and core components like `SearchResult`.
- Usage examples showcasing search queries, filtering by noun/verb types, and advanced features like multi-modal search.
- Included performance tips on caching, HNSW indexing, lazy loading, and augmentation pipeline.
- **Storage System Updates**:
- Enhanced memory and file storage adapters to support dedicated noun and verb metadata handling:
- Added methods `saveN
This commit is contained in:
parent
73bafd2c43
commit
4652a9f9c0
5 changed files with 472 additions and 4 deletions
|
|
@ -18,6 +18,8 @@ export class MemoryStorage extends BaseStorage {
|
|||
private nouns: Map<string, HNSWNoun> = new Map()
|
||||
private verbs: Map<string, GraphVerb> = new Map()
|
||||
private metadata: Map<string, any> = new Map()
|
||||
private nounMetadata: Map<string, any> = new Map()
|
||||
private verbMetadata: Map<string, any> = new Map()
|
||||
private statistics: StatisticsData | null = null
|
||||
|
||||
constructor() {
|
||||
|
|
@ -557,6 +559,44 @@ export class MemoryStorage extends BaseStorage {
|
|||
return JSON.parse(JSON.stringify(metadata))
|
||||
}
|
||||
|
||||
/**
|
||||
* Save noun metadata to storage
|
||||
*/
|
||||
public async saveNounMetadata(id: string, metadata: any): Promise<void> {
|
||||
this.nounMetadata.set(id, JSON.parse(JSON.stringify(metadata)))
|
||||
}
|
||||
|
||||
/**
|
||||
* Get noun metadata from storage
|
||||
*/
|
||||
public async getNounMetadata(id: string): Promise<any | null> {
|
||||
const metadata = this.nounMetadata.get(id)
|
||||
if (!metadata) {
|
||||
return null
|
||||
}
|
||||
|
||||
return JSON.parse(JSON.stringify(metadata))
|
||||
}
|
||||
|
||||
/**
|
||||
* Save verb metadata to storage
|
||||
*/
|
||||
public async saveVerbMetadata(id: string, metadata: any): Promise<void> {
|
||||
this.verbMetadata.set(id, JSON.parse(JSON.stringify(metadata)))
|
||||
}
|
||||
|
||||
/**
|
||||
* Get verb metadata from storage
|
||||
*/
|
||||
public async getVerbMetadata(id: string): Promise<any | null> {
|
||||
const metadata = this.verbMetadata.get(id)
|
||||
if (!metadata) {
|
||||
return null
|
||||
}
|
||||
|
||||
return JSON.parse(JSON.stringify(metadata))
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all data from storage
|
||||
*/
|
||||
|
|
@ -564,6 +604,8 @@ export class MemoryStorage extends BaseStorage {
|
|||
this.nouns.clear()
|
||||
this.verbs.clear()
|
||||
this.metadata.clear()
|
||||
this.nounMetadata.clear()
|
||||
this.verbMetadata.clear()
|
||||
this.statistics = null
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue