Commit graph

132 commits

Author SHA1 Message Date
yangdx
8c4d7a00ad Refactor: Extract retry decorator to reduce code duplication in Neo4J storage
• Define READ_RETRY_EXCEPTIONS constant
• Create reusable READ_RETRY decorator
• Replace 11 duplicate retry decorators
• Improve code maintainability
• Add missing retry to edge_degrees_batch
2025-11-25 01:35:21 +08:00
yangdx
7aaa51cda9 Add retry decorators to Neo4j read operations for resilience 2025-11-24 22:28:15 +08:00
yangdx
926960e957 Refactor workspace handling to use default workspace and namespace locks
- Remove DB-specific workspace configs
- Add default workspace auto-setting
- Replace global locks with namespace locks
- Simplify pipeline status management
- Remove redundant graph DB locking
2025-11-17 12:54:33 +08:00
yangdx
423e4e927a Fix null reference errors in graph database error handling
- Initialize result vars to None
- Add null checks before consume calls
- Prevent crashes in except blocks
- Apply fix to both Neo4J and Memgraph
2025-11-17 12:54:32 +08:00
yangdx
807d2461d3 Remove unused chunk-based node/edge retrieval methods 2025-11-06 18:17:10 +08:00
yangdx
040b0c8620 Fix Neo4J index creation to check state instead of analyzer
• Check index state not analyzer
• Skip if index is ONLINE
• Recreate if state not ONLINE
• Simplify recreation logic
2025-09-20 23:51:50 +08:00
yangdx
5da1df3b19 Fix linting 2025-09-20 15:30:27 +08:00
yangdx
8e2a1fa59e Enhance Neo4j fulltext search with Chinese language support
• Add CJK analyzer for Chinese text
• Auto-detect Chinese characters
• Recreate index if needed
• Separate Chinese/Latin search logic
• Improve fallback for Chinese queries
2025-09-20 15:19:22 +08:00
yangdx
e14cee69a3 Fix Neo4j typo and add fulltext search with performance optimizations
- Fix NEO4J_DATABASE typo in env.example
- Add fulltext index for entity searches
- Implement get_popular_labels method
- Add search_labels with fuzzy matching
- Simplify B-Tree index creation logic
2025-09-20 12:37:13 +08:00
yangdx
2a781dfb91 Update Neo4j database naming in env.example 2025-08-15 19:14:38 +08:00
yangdx
0b22ffb252 Refac: uniformly protected with the get_data_init_lock for all storage initializations 2025-08-14 03:46:19 +08:00
yangdx
fc8ca1a706 Fix: add muti-process lock for initialize and drop method for all storage 2025-08-12 04:25:09 +08:00
yangdx
095e0cbfa2 Refac: Add workspace infomation to all logger output for all storage type 2025-08-12 01:19:09 +08:00
yangdx
f4ef254de2 fix(neo4j): enhance connection lifecycle management to prevent timeout errors
- Add max_connection_lifetime, liveness_check_timeout, keep_alive parameters
- Extend retry mechanisms for connection reset scenarios
- Update config examples with new Neo4j connection options
- Resolves ClientTimeoutException during data insertion operations
2025-08-08 01:07:45 +08:00
yangdx
d2dd137f83 feat: implement get_all_nodes and get_all_edges methods for graph storage backends
Add get_all_nodes() and get_all_edges() methods to Neo4JStorage, PGGraphStorage, MongoGraphStorage, and MemgraphStorage classes. These methods return all nodes and edges in the graph with consistent formatting matching NetworkXStorage for compatibility across different storage backends.
2025-08-03 11:02:37 +08:00
yangdx
2c7d2b3f5f Increase Neo4j connection pool size and timeouts
- Bump default connection pool size to 100
- Add new Neo4j timeout env variables to env.example
2025-07-19 13:27:34 +08:00
yangdx
7184c7b3ab fix: change default edge weight from 0.0 to 1.0 in entity extraction and graph storage
- Update extract_entities function in operate.py to use 1.0 as default weight
- Fix Neo4j implementation to use 1.0 instead of 0.0 for missing edge weights
- Fix Memgraph implementation to use 1.0 instead of 0.0 for missing edge weights
- Ensures consistent non-zero default weights across all graph storage backends
2025-07-17 11:30:49 +08:00
yangdx
ef79088f60 Move max_graph_nodes to global config 2025-07-07 21:53:57 +08:00
yangdx
4632adb355 Add NEO4J_WORKSPACE env var override support
- Allow workspace override via NEO4J_WORKSPACE
- Update env.example with new config option
2025-07-07 04:16:44 +08:00
yangdx
033098c1bc Feat: Add WORKSPACE support to all storage types 2025-07-07 00:57:21 +08:00
yangdx
da46b341dc feat: Optimize document deletion performance
- To enhance performance during document deletion, new batch-get methods, `get_nodes_by_chunk_ids` and `get_edges_by_chunk_ids`, have been added to the graph storage layer (`BaseGraphStorage` and its implementations). The [`adelete_by_doc_id`](lightrag/lightrag.py:1681) function now leverages these methods to avoid unnecessary iteration over the entire knowledge graph, significantly improving efficiency.
- Graph storage updated: Networkx, Neo4j, Postgres AGE
2025-06-25 12:37:57 +08:00
yangdx
fd69c895cd Remove debug looging from Neo4j 2025-06-24 01:03:02 +08:00
yangdx
64d0df0caa Remove debug logging from Neo4J operations
- Delete node upsert debug log
- Remove edge upsert debug messages
2025-06-24 00:45:17 +08:00
yangdx
dff73f078d Fix linting 2025-04-25 22:01:06 +08:00
yangdx
04ebcbebd0 Translate comments to English 2025-04-25 21:54:04 +08:00
yangdx
d4c4a40c53 Fix M.env AX_GRAPH_NODES not working problem 2025-04-17 01:28:22 +08:00
yangdx
33e8b9f284 Fix edge direction problem for Neo4j storage 2025-04-16 14:24:28 +08:00
yangdx
1de74c9228 Fix linting 2025-04-15 12:34:04 +08:00
yangdx
e9b04e5bd2 Merge branch 'graph-storage-batch-query-frederikhendrix' into graph-storage-batch-query 2025-04-12 22:20:41 +08:00
yangdx
745301ea13 Deleted node2vec implementation 2025-04-11 18:41:45 +08:00
yangdx
83353ab9a6 Remove unused node embedding functionality from graph storage
- Deleted embed_nodes() method implementations
2025-04-11 18:34:48 +08:00
frederikhendrix
182aee2e14 get_node added and all to base.py and to neo4j_impl.py file 2025-04-07 19:09:31 +02:00
IcySugar
fe36488bc9
Update neo4j_impl.py
Fix: added the "f" for format for logger
2025-04-07 16:56:33 +08:00
yangdx
689cf44a5d Let get_edge return None when edge not found 2025-04-04 02:48:30 +08:00
yangdx
b003537429 Fix APOC fallback error 2025-04-04 02:05:29 +08:00
yangdx
399b2f14f6 Fix linting 2025-04-04 00:07:21 +08:00
yangdx
6b240fa9b2 Serialize merge precess to prevent race conditions 2025-04-03 21:33:46 +08:00
yangdx
3e3338a144 Fix get_node error for PostgreSQL graph storage 2025-04-03 15:40:31 +08:00
yangdx
8878c0e998 Fix get_all_labels for PostgreSQL 2025-04-03 04:10:20 +08:00
yangdx
c339f8686a Add is_truncated to graph query for Neo4j 2025-04-02 23:20:07 +08:00
yangdx
82c4baba70 Add is_truncated to graph query for NetworkX graph db 2025-04-02 22:12:20 +08:00
yangdx
a50edffdb0 Optimize Neo4J subgraph query performance 2025-04-02 20:53:15 +08:00
yangdx
fb2fad7766 Update comments of get_knowledge_graph func for Noe4j 2025-04-02 17:02:01 +08:00
yangdx
c2f007199f Fix linting 2025-04-02 16:36:28 +08:00
yangdx
3ed7f11b4c Add index on entity_id for Neo4j 2025-04-02 16:36:02 +08:00
yangdx
4994bd1461 Simplified graph retrival by removing inclusive and min_degree parameters 2025-04-02 16:27:58 +08:00
yangdx
fc3208cf5b Filter nodes by :base for entity label retrieval in Neo4j 2025-04-02 12:53:17 +08:00
yangdx
c72c149e71 Fix linting 2025-04-02 12:16:40 +08:00
yangdx
cd67d7cd79 Removed redundant entity_id extraction in upsert logic for Neo4JStorage 2025-04-02 12:16:13 +08:00
yangdx
5f678adb71 Refactor Neo4J storage initialization and cleanup
- Make initialization async
- Rename close() to finalize()
2025-04-02 10:45:21 +08:00