@danielsimonjr/memory-mcp 12.2.3 → 12.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -102
- package/dist/index.js +6 -0
- package/dist/server/toolDefinitions.d.ts.map +1 -1
- package/dist/server/toolDefinitions.js +745 -3
- package/dist/server/toolHandlers.d.ts +1 -9
- package/dist/server/toolHandlers.d.ts.map +1 -1
- package/dist/server/toolHandlers.js +859 -11
- package/package.json +9 -6
- package/dist/core/EntityManager.d.ts +0 -263
- package/dist/core/EntityManager.d.ts.map +0 -1
- package/dist/core/EntityManager.js +0 -478
- package/dist/core/GraphStorage.d.ts +0 -344
- package/dist/core/GraphStorage.d.ts.map +0 -1
- package/dist/core/GraphStorage.js +0 -708
- package/dist/core/GraphTraversal.d.ts +0 -136
- package/dist/core/GraphTraversal.d.ts.map +0 -1
- package/dist/core/GraphTraversal.js +0 -556
- package/dist/core/HierarchyManager.d.ts +0 -111
- package/dist/core/HierarchyManager.d.ts.map +0 -1
- package/dist/core/HierarchyManager.js +0 -224
- package/dist/core/ManagerContext.d.ts +0 -72
- package/dist/core/ManagerContext.d.ts.map +0 -1
- package/dist/core/ManagerContext.js +0 -118
- package/dist/core/ObservationManager.d.ts +0 -85
- package/dist/core/ObservationManager.d.ts.map +0 -1
- package/dist/core/ObservationManager.js +0 -123
- package/dist/core/RelationManager.d.ts +0 -131
- package/dist/core/RelationManager.d.ts.map +0 -1
- package/dist/core/RelationManager.js +0 -210
- package/dist/core/SQLiteStorage.d.ts +0 -354
- package/dist/core/SQLiteStorage.d.ts.map +0 -1
- package/dist/core/SQLiteStorage.js +0 -917
- package/dist/core/StorageFactory.d.ts +0 -45
- package/dist/core/StorageFactory.d.ts.map +0 -1
- package/dist/core/StorageFactory.js +0 -64
- package/dist/core/TransactionManager.d.ts +0 -259
- package/dist/core/TransactionManager.d.ts.map +0 -1
- package/dist/core/TransactionManager.js +0 -392
- package/dist/core/index.d.ts +0 -16
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -17
- package/dist/features/AnalyticsManager.d.ts +0 -44
- package/dist/features/AnalyticsManager.d.ts.map +0 -1
- package/dist/features/AnalyticsManager.js +0 -223
- package/dist/features/ArchiveManager.d.ts +0 -121
- package/dist/features/ArchiveManager.d.ts.map +0 -1
- package/dist/features/ArchiveManager.js +0 -240
- package/dist/features/CompressionManager.d.ts +0 -109
- package/dist/features/CompressionManager.d.ts.map +0 -1
- package/dist/features/CompressionManager.js +0 -404
- package/dist/features/IOManager.d.ts +0 -221
- package/dist/features/IOManager.d.ts.map +0 -1
- package/dist/features/IOManager.js +0 -997
- package/dist/features/StreamingExporter.d.ts +0 -105
- package/dist/features/StreamingExporter.d.ts.map +0 -1
- package/dist/features/StreamingExporter.js +0 -150
- package/dist/features/TagManager.d.ts +0 -147
- package/dist/features/TagManager.d.ts.map +0 -1
- package/dist/features/TagManager.js +0 -210
- package/dist/features/index.d.ts +0 -12
- package/dist/features/index.d.ts.map +0 -1
- package/dist/features/index.js +0 -11
- package/dist/search/BasicSearch.d.ts +0 -51
- package/dist/search/BasicSearch.d.ts.map +0 -1
- package/dist/search/BasicSearch.js +0 -137
- package/dist/search/BooleanSearch.d.ts +0 -98
- package/dist/search/BooleanSearch.d.ts.map +0 -1
- package/dist/search/BooleanSearch.js +0 -430
- package/dist/search/EmbeddingService.d.ts +0 -178
- package/dist/search/EmbeddingService.d.ts.map +0 -1
- package/dist/search/EmbeddingService.js +0 -358
- package/dist/search/FuzzySearch.d.ts +0 -118
- package/dist/search/FuzzySearch.d.ts.map +0 -1
- package/dist/search/FuzzySearch.js +0 -312
- package/dist/search/RankedSearch.d.ts +0 -71
- package/dist/search/RankedSearch.d.ts.map +0 -1
- package/dist/search/RankedSearch.js +0 -238
- package/dist/search/SavedSearchManager.d.ts +0 -79
- package/dist/search/SavedSearchManager.d.ts.map +0 -1
- package/dist/search/SavedSearchManager.js +0 -145
- package/dist/search/SearchFilterChain.d.ts +0 -120
- package/dist/search/SearchFilterChain.d.ts.map +0 -1
- package/dist/search/SearchFilterChain.js +0 -185
- package/dist/search/SearchManager.d.ts +0 -285
- package/dist/search/SearchManager.d.ts.map +0 -1
- package/dist/search/SearchManager.js +0 -338
- package/dist/search/SearchSuggestions.d.ts +0 -27
- package/dist/search/SearchSuggestions.d.ts.map +0 -1
- package/dist/search/SearchSuggestions.js +0 -57
- package/dist/search/SemanticSearch.d.ts +0 -146
- package/dist/search/SemanticSearch.d.ts.map +0 -1
- package/dist/search/SemanticSearch.js +0 -313
- package/dist/search/TFIDFIndexManager.d.ts +0 -63
- package/dist/search/TFIDFIndexManager.d.ts.map +0 -1
- package/dist/search/TFIDFIndexManager.js +0 -215
- package/dist/search/VectorStore.d.ts +0 -235
- package/dist/search/VectorStore.d.ts.map +0 -1
- package/dist/search/VectorStore.js +0 -311
- package/dist/search/index.d.ts +0 -18
- package/dist/search/index.d.ts.map +0 -1
- package/dist/search/index.js +0 -21
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -12
- package/dist/types/types.d.ts +0 -1234
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js +0 -9
- package/dist/utils/compressedCache.d.ts +0 -192
- package/dist/utils/compressedCache.d.ts.map +0 -1
- package/dist/utils/compressedCache.js +0 -309
- package/dist/utils/compressionUtil.d.ts +0 -214
- package/dist/utils/compressionUtil.d.ts.map +0 -1
- package/dist/utils/compressionUtil.js +0 -247
- package/dist/utils/constants.d.ts +0 -245
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/constants.js +0 -252
- package/dist/utils/entityUtils.d.ts +0 -321
- package/dist/utils/entityUtils.d.ts.map +0 -1
- package/dist/utils/entityUtils.js +0 -538
- package/dist/utils/errors.d.ts +0 -77
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -121
- package/dist/utils/formatters.d.ts +0 -145
- package/dist/utils/formatters.d.ts.map +0 -1
- package/dist/utils/formatters.js +0 -132
- package/dist/utils/index.d.ts +0 -22
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -75
- package/dist/utils/indexes.d.ts +0 -270
- package/dist/utils/indexes.d.ts.map +0 -1
- package/dist/utils/indexes.js +0 -526
- package/dist/utils/logger.d.ts +0 -24
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -33
- package/dist/utils/parallelUtils.d.ts +0 -72
- package/dist/utils/parallelUtils.d.ts.map +0 -1
- package/dist/utils/parallelUtils.js +0 -169
- package/dist/utils/schemas.d.ts +0 -374
- package/dist/utils/schemas.d.ts.map +0 -1
- package/dist/utils/schemas.js +0 -484
- package/dist/utils/searchAlgorithms.d.ts +0 -99
- package/dist/utils/searchAlgorithms.d.ts.map +0 -1
- package/dist/utils/searchAlgorithms.js +0 -167
- package/dist/utils/searchCache.d.ts +0 -108
- package/dist/utils/searchCache.d.ts.map +0 -1
- package/dist/utils/searchCache.js +0 -209
- package/dist/utils/taskScheduler.d.ts +0 -290
- package/dist/utils/taskScheduler.d.ts.map +0 -1
- package/dist/utils/taskScheduler.js +0 -466
- package/dist/workers/WorkerPool.d.ts +0 -81
- package/dist/workers/WorkerPool.d.ts.map +0 -1
- package/dist/workers/WorkerPool.js +0 -121
- package/dist/workers/index.d.ts +0 -12
- package/dist/workers/index.d.ts.map +0 -1
- package/dist/workers/index.js +0 -9
- package/dist/workers/levenshteinWorker.d.ts +0 -60
- package/dist/workers/levenshteinWorker.d.ts.map +0 -1
- package/dist/workers/levenshteinWorker.js +0 -98
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Basic Search
|
|
3
|
-
*
|
|
4
|
-
* Simple text-based search with tag, importance, and date filters with result caching.
|
|
5
|
-
*
|
|
6
|
-
* @module search/BasicSearch
|
|
7
|
-
*/
|
|
8
|
-
import type { KnowledgeGraph } from '../types/index.js';
|
|
9
|
-
import type { GraphStorage } from '../core/GraphStorage.js';
|
|
10
|
-
/**
|
|
11
|
-
* Performs basic text search with optional filters and caching.
|
|
12
|
-
*/
|
|
13
|
-
export declare class BasicSearch {
|
|
14
|
-
private storage;
|
|
15
|
-
private enableCache;
|
|
16
|
-
constructor(storage: GraphStorage, enableCache?: boolean);
|
|
17
|
-
/**
|
|
18
|
-
* Search nodes by text query with optional filters and pagination.
|
|
19
|
-
*
|
|
20
|
-
* Searches across entity names, types, and observations.
|
|
21
|
-
*
|
|
22
|
-
* @param query - Text to search for (case-insensitive)
|
|
23
|
-
* @param tags - Optional tags to filter by
|
|
24
|
-
* @param minImportance - Optional minimum importance (0-10)
|
|
25
|
-
* @param maxImportance - Optional maximum importance (0-10)
|
|
26
|
-
* @param offset - Number of results to skip (default: 0)
|
|
27
|
-
* @param limit - Maximum number of results (default: 50, max: 200)
|
|
28
|
-
* @returns Filtered knowledge graph with pagination applied
|
|
29
|
-
*/
|
|
30
|
-
searchNodes(query: string, tags?: string[], minImportance?: number, maxImportance?: number, offset?: number, limit?: number): Promise<KnowledgeGraph>;
|
|
31
|
-
/**
|
|
32
|
-
* Open specific nodes by name.
|
|
33
|
-
*
|
|
34
|
-
* @param names - Array of entity names to retrieve
|
|
35
|
-
* @returns Knowledge graph with specified entities and their relations
|
|
36
|
-
*/
|
|
37
|
-
openNodes(names: string[]): Promise<KnowledgeGraph>;
|
|
38
|
-
/**
|
|
39
|
-
* Search by date range with optional filters and pagination.
|
|
40
|
-
*
|
|
41
|
-
* @param startDate - Optional start date (ISO 8601)
|
|
42
|
-
* @param endDate - Optional end date (ISO 8601)
|
|
43
|
-
* @param entityType - Optional entity type filter
|
|
44
|
-
* @param tags - Optional tags filter
|
|
45
|
-
* @param offset - Number of results to skip (default: 0)
|
|
46
|
-
* @param limit - Maximum number of results (default: 50, max: 200)
|
|
47
|
-
* @returns Filtered knowledge graph with pagination applied
|
|
48
|
-
*/
|
|
49
|
-
searchByDateRange(startDate?: string, endDate?: string, entityType?: string, tags?: string[], offset?: number, limit?: number): Promise<KnowledgeGraph>;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=BasicSearch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BasicSearch.d.ts","sourceRoot":"","sources":["../../src/search/BasicSearch.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAI5D;;GAEG;AACH,qBAAa,WAAW;IAEpB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,WAAW;gBADX,OAAO,EAAE,YAAY,EACrB,WAAW,GAAE,OAAc;IAGrC;;;;;;;;;;;;OAYG;IACG,WAAW,CACf,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,aAAa,CAAC,EAAE,MAAM,EACtB,aAAa,CAAC,EAAE,MAAM,EACtB,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,MAA8B,GACpC,OAAO,CAAC,cAAc,CAAC;IAwD1B;;;;;OAKG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAYzD;;;;;;;;;;OAUG;IACG,iBAAiB,CACrB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,MAA8B,GACpC,OAAO,CAAC,cAAc,CAAC;CAiD3B"}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Basic Search
|
|
3
|
-
*
|
|
4
|
-
* Simple text-based search with tag, importance, and date filters with result caching.
|
|
5
|
-
*
|
|
6
|
-
* @module search/BasicSearch
|
|
7
|
-
*/
|
|
8
|
-
import { isWithinDateRange, SEARCH_LIMITS, searchCaches } from '../utils/index.js';
|
|
9
|
-
import { SearchFilterChain } from './SearchFilterChain.js';
|
|
10
|
-
/**
|
|
11
|
-
* Performs basic text search with optional filters and caching.
|
|
12
|
-
*/
|
|
13
|
-
export class BasicSearch {
|
|
14
|
-
storage;
|
|
15
|
-
enableCache;
|
|
16
|
-
constructor(storage, enableCache = true) {
|
|
17
|
-
this.storage = storage;
|
|
18
|
-
this.enableCache = enableCache;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Search nodes by text query with optional filters and pagination.
|
|
22
|
-
*
|
|
23
|
-
* Searches across entity names, types, and observations.
|
|
24
|
-
*
|
|
25
|
-
* @param query - Text to search for (case-insensitive)
|
|
26
|
-
* @param tags - Optional tags to filter by
|
|
27
|
-
* @param minImportance - Optional minimum importance (0-10)
|
|
28
|
-
* @param maxImportance - Optional maximum importance (0-10)
|
|
29
|
-
* @param offset - Number of results to skip (default: 0)
|
|
30
|
-
* @param limit - Maximum number of results (default: 50, max: 200)
|
|
31
|
-
* @returns Filtered knowledge graph with pagination applied
|
|
32
|
-
*/
|
|
33
|
-
async searchNodes(query, tags, minImportance, maxImportance, offset = 0, limit = SEARCH_LIMITS.DEFAULT) {
|
|
34
|
-
// Check cache first
|
|
35
|
-
if (this.enableCache) {
|
|
36
|
-
const cacheKey = { query, tags, minImportance, maxImportance, offset, limit };
|
|
37
|
-
const cached = searchCaches.basic.get(cacheKey);
|
|
38
|
-
if (cached) {
|
|
39
|
-
return cached;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const graph = await this.storage.loadGraph();
|
|
43
|
-
const queryLower = query.toLowerCase();
|
|
44
|
-
// First filter by text match (search-specific)
|
|
45
|
-
// OPTIMIZED: Uses pre-computed lowercase cache to avoid repeated toLowerCase() calls
|
|
46
|
-
const textMatched = graph.entities.filter(e => {
|
|
47
|
-
const lowercased = this.storage.getLowercased(e.name);
|
|
48
|
-
if (lowercased) {
|
|
49
|
-
return (lowercased.name.includes(queryLower) ||
|
|
50
|
-
lowercased.entityType.includes(queryLower) ||
|
|
51
|
-
lowercased.observations.some(o => o.includes(queryLower)));
|
|
52
|
-
}
|
|
53
|
-
// Fallback for entities not in cache (shouldn't happen in normal use)
|
|
54
|
-
return (e.name.toLowerCase().includes(queryLower) ||
|
|
55
|
-
e.entityType.toLowerCase().includes(queryLower) ||
|
|
56
|
-
e.observations.some(o => o.toLowerCase().includes(queryLower)));
|
|
57
|
-
});
|
|
58
|
-
// Apply tag and importance filters using SearchFilterChain
|
|
59
|
-
const filters = { tags, minImportance, maxImportance };
|
|
60
|
-
const filteredEntities = SearchFilterChain.applyFilters(textMatched, filters);
|
|
61
|
-
// Apply pagination using SearchFilterChain
|
|
62
|
-
const pagination = SearchFilterChain.validatePagination(offset, limit);
|
|
63
|
-
const paginatedEntities = SearchFilterChain.paginate(filteredEntities, pagination);
|
|
64
|
-
const filteredEntityNames = new Set(paginatedEntities.map(e => e.name));
|
|
65
|
-
const filteredRelations = graph.relations.filter(r => filteredEntityNames.has(r.from) && filteredEntityNames.has(r.to));
|
|
66
|
-
const result = { entities: paginatedEntities, relations: filteredRelations };
|
|
67
|
-
// Cache the result
|
|
68
|
-
if (this.enableCache) {
|
|
69
|
-
const cacheKey = { query, tags, minImportance, maxImportance, offset, limit };
|
|
70
|
-
searchCaches.basic.set(cacheKey, result);
|
|
71
|
-
}
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Open specific nodes by name.
|
|
76
|
-
*
|
|
77
|
-
* @param names - Array of entity names to retrieve
|
|
78
|
-
* @returns Knowledge graph with specified entities and their relations
|
|
79
|
-
*/
|
|
80
|
-
async openNodes(names) {
|
|
81
|
-
const graph = await this.storage.loadGraph();
|
|
82
|
-
const filteredEntities = graph.entities.filter(e => names.includes(e.name));
|
|
83
|
-
const filteredEntityNames = new Set(filteredEntities.map(e => e.name));
|
|
84
|
-
const filteredRelations = graph.relations.filter(r => filteredEntityNames.has(r.from) && filteredEntityNames.has(r.to));
|
|
85
|
-
return { entities: filteredEntities, relations: filteredRelations };
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Search by date range with optional filters and pagination.
|
|
89
|
-
*
|
|
90
|
-
* @param startDate - Optional start date (ISO 8601)
|
|
91
|
-
* @param endDate - Optional end date (ISO 8601)
|
|
92
|
-
* @param entityType - Optional entity type filter
|
|
93
|
-
* @param tags - Optional tags filter
|
|
94
|
-
* @param offset - Number of results to skip (default: 0)
|
|
95
|
-
* @param limit - Maximum number of results (default: 50, max: 200)
|
|
96
|
-
* @returns Filtered knowledge graph with pagination applied
|
|
97
|
-
*/
|
|
98
|
-
async searchByDateRange(startDate, endDate, entityType, tags, offset = 0, limit = SEARCH_LIMITS.DEFAULT) {
|
|
99
|
-
// Check cache first
|
|
100
|
-
if (this.enableCache) {
|
|
101
|
-
const cacheKey = { method: 'dateRange', startDate, endDate, entityType, tags, offset, limit };
|
|
102
|
-
const cached = searchCaches.basic.get(cacheKey);
|
|
103
|
-
if (cached) {
|
|
104
|
-
return cached;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
const graph = await this.storage.loadGraph();
|
|
108
|
-
// First filter by date range (search-specific - uses createdAt OR lastModified)
|
|
109
|
-
const dateFiltered = graph.entities.filter(e => {
|
|
110
|
-
const dateToCheck = e.createdAt || e.lastModified;
|
|
111
|
-
if (dateToCheck && !isWithinDateRange(dateToCheck, startDate, endDate)) {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
return true;
|
|
115
|
-
});
|
|
116
|
-
// Apply entity type and tag filters using SearchFilterChain
|
|
117
|
-
const filters = { tags, entityType };
|
|
118
|
-
const filteredEntities = SearchFilterChain.applyFilters(dateFiltered, filters);
|
|
119
|
-
// Apply pagination using SearchFilterChain
|
|
120
|
-
const pagination = SearchFilterChain.validatePagination(offset, limit);
|
|
121
|
-
const paginatedEntities = SearchFilterChain.paginate(filteredEntities, pagination);
|
|
122
|
-
const filteredEntityNames = new Set(paginatedEntities.map(e => e.name));
|
|
123
|
-
const filteredRelations = graph.relations.filter(r => {
|
|
124
|
-
const dateToCheck = r.createdAt || r.lastModified;
|
|
125
|
-
const inDateRange = !dateToCheck || isWithinDateRange(dateToCheck, startDate, endDate);
|
|
126
|
-
const involvesFilteredEntities = filteredEntityNames.has(r.from) && filteredEntityNames.has(r.to);
|
|
127
|
-
return inDateRange && involvesFilteredEntities;
|
|
128
|
-
});
|
|
129
|
-
const result = { entities: paginatedEntities, relations: filteredRelations };
|
|
130
|
-
// Cache the result
|
|
131
|
-
if (this.enableCache) {
|
|
132
|
-
const cacheKey = { method: 'dateRange', startDate, endDate, entityType, tags, offset, limit };
|
|
133
|
-
searchCaches.basic.set(cacheKey, result);
|
|
134
|
-
}
|
|
135
|
-
return result;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Boolean Search
|
|
3
|
-
*
|
|
4
|
-
* Advanced search with boolean operators (AND, OR, NOT) and field-specific queries.
|
|
5
|
-
*
|
|
6
|
-
* @module search/BooleanSearch
|
|
7
|
-
*/
|
|
8
|
-
import type { KnowledgeGraph } from '../types/index.js';
|
|
9
|
-
import type { GraphStorage } from '../core/GraphStorage.js';
|
|
10
|
-
/**
|
|
11
|
-
* Performs boolean search with query parsing and AST evaluation.
|
|
12
|
-
*/
|
|
13
|
-
export declare class BooleanSearch {
|
|
14
|
-
private storage;
|
|
15
|
-
/**
|
|
16
|
-
* Phase 4 Sprint 4: AST cache to avoid re-parsing queries.
|
|
17
|
-
* Maps query string -> parsed AST.
|
|
18
|
-
*/
|
|
19
|
-
private astCache;
|
|
20
|
-
/**
|
|
21
|
-
* Phase 4 Sprint 4: Result cache for boolean search.
|
|
22
|
-
* Maps cache key -> cached results.
|
|
23
|
-
*/
|
|
24
|
-
private resultCache;
|
|
25
|
-
constructor(storage: GraphStorage);
|
|
26
|
-
/**
|
|
27
|
-
* Phase 4 Sprint 4: Generate cache key for boolean search.
|
|
28
|
-
*/
|
|
29
|
-
private generateCacheKey;
|
|
30
|
-
/**
|
|
31
|
-
* Phase 4 Sprint 4: Clear all caches.
|
|
32
|
-
*/
|
|
33
|
-
clearCache(): void;
|
|
34
|
-
/**
|
|
35
|
-
* Phase 4 Sprint 4: Cleanup old cache entries.
|
|
36
|
-
*/
|
|
37
|
-
private cleanupResultCache;
|
|
38
|
-
/**
|
|
39
|
-
* Phase 4 Sprint 4: Get or parse AST for a query.
|
|
40
|
-
*/
|
|
41
|
-
private getOrParseAST;
|
|
42
|
-
/**
|
|
43
|
-
* Boolean search with support for AND, OR, NOT operators, field-specific queries, and pagination.
|
|
44
|
-
*
|
|
45
|
-
* Phase 4 Sprint 4: Implements AST caching and result caching for repeated queries.
|
|
46
|
-
*
|
|
47
|
-
* Query syntax examples:
|
|
48
|
-
* - "alice AND programming" - Both terms must match
|
|
49
|
-
* - "type:person OR type:organization" - Either type matches
|
|
50
|
-
* - "NOT archived" - Exclude archived items
|
|
51
|
-
* - "name:alice AND (observation:coding OR observation:teaching)"
|
|
52
|
-
*
|
|
53
|
-
* @param query - Boolean query string
|
|
54
|
-
* @param tags - Optional tags filter
|
|
55
|
-
* @param minImportance - Optional minimum importance
|
|
56
|
-
* @param maxImportance - Optional maximum importance
|
|
57
|
-
* @param offset - Number of results to skip (default: 0)
|
|
58
|
-
* @param limit - Maximum number of results (default: 50, max: 200)
|
|
59
|
-
* @returns Filtered knowledge graph matching the boolean query with pagination applied
|
|
60
|
-
*/
|
|
61
|
-
booleanSearch(query: string, tags?: string[], minImportance?: number, maxImportance?: number, offset?: number, limit?: number): Promise<KnowledgeGraph>;
|
|
62
|
-
/**
|
|
63
|
-
* Tokenize a boolean query into tokens.
|
|
64
|
-
*
|
|
65
|
-
* Handles quoted strings, parentheses, and operators.
|
|
66
|
-
*/
|
|
67
|
-
private tokenizeBooleanQuery;
|
|
68
|
-
/**
|
|
69
|
-
* Parse a boolean search query into an AST.
|
|
70
|
-
*
|
|
71
|
-
* Supports: AND, OR, NOT, parentheses, field-specific queries (field:value)
|
|
72
|
-
*/
|
|
73
|
-
private parseBooleanQuery;
|
|
74
|
-
/**
|
|
75
|
-
* Evaluate a boolean query AST against an entity.
|
|
76
|
-
*/
|
|
77
|
-
private evaluateBooleanQuery;
|
|
78
|
-
/**
|
|
79
|
-
* Check if a search term is simple (no regex or wildcards).
|
|
80
|
-
* Simple terms can use the O(1) observation index.
|
|
81
|
-
*/
|
|
82
|
-
private isSimpleTerm;
|
|
83
|
-
/**
|
|
84
|
-
* Check if entity matches a search term in any text field.
|
|
85
|
-
* OPTIMIZED: Uses pre-computed lowercase data when available.
|
|
86
|
-
*/
|
|
87
|
-
private entityMatchesTerm;
|
|
88
|
-
/**
|
|
89
|
-
* Validate query complexity to prevent resource exhaustion.
|
|
90
|
-
* Checks nesting depth, term count, and operator count against configured limits.
|
|
91
|
-
*/
|
|
92
|
-
private validateQueryComplexity;
|
|
93
|
-
/**
|
|
94
|
-
* Calculate query complexity metrics.
|
|
95
|
-
*/
|
|
96
|
-
private calculateQueryComplexity;
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=BooleanSearch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanSearch.d.ts","sourceRoot":"","sources":["../../src/search/BooleanSearch.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAA4B,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAkC5D;;GAEG;AACH,qBAAa,aAAa;IAaZ,OAAO,CAAC,OAAO;IAZ3B;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAA4C;IAE5D;;;OAGG;IACH,OAAO,CAAC,WAAW,CAA6C;gBAE5C,OAAO,EAAE,YAAY;IAEzC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAkBxB;;OAEG;IACH,UAAU,IAAI,IAAI;IAKlB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAwB1B;;OAEG;IACH,OAAO,CAAC,aAAa;IAqBrB;;;;;;;;;;;;;;;;;;OAkBG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,aAAa,CAAC,EAAE,MAAM,EACtB,aAAa,CAAC,EAAE,MAAM,EACtB,MAAM,GAAE,MAAU,EAClB,KAAK,GAAE,MAA8B,GACpC,OAAO,CAAC,cAAc,CAAC;IA2E1B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IA+C5B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAuFzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA2D5B;;;OAGG;IACH,OAAO,CAAC,YAAY;IAKpB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAoBzB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IA2B/B;;OAEG;IACH,OAAO,CAAC,wBAAwB;CA8BjC"}
|