Skip to content

Conversation

@dataroaring
Copy link

This commit adds Apache Doris as a new vector database option for Dify's RAG system.

Features:

  • Vector similarity search using cosine distance
  • Full-text search with BM25 scoring and inverted indexes
  • Hybrid search combining vector and text search
  • High-performance bulk data loading via StreamLoad
  • Connection pooling for efficient resource management
  • Support for multi-tenant isolation

Components added:

  • DorisVector: Main vector database implementation with cleaned code
  • DorisConfig: Configuration model with validation
  • DorisConnectionPool: Thread-safe connection management
  • DorisVectorFactory: Factory for creating Doris instances
  • DORIS_SETUP.md: Complete setup guide in English

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

Copilot AI review requested due to automatic review settings January 3, 2026 06:25
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. 👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. labels Jan 3, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dataroaring, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates Apache Doris as a new vector database option within the Dify RAG system. This enhancement provides Dify users with an additional robust and scalable solution for managing and querying document embeddings, supporting advanced search functionalities like vector similarity, full-text, and hybrid search. The implementation focuses on performance and ease of configuration, leveraging Doris's native capabilities for efficient data handling.

Highlights

  • Apache Doris Integration: Adds Apache Doris as a new vector database option for Dify's RAG system, expanding the supported vector store ecosystem.
  • Vector Similarity Search: Implements vector similarity search using cosine distance, enabling semantic retrieval of documents.
  • Full-Text Search: Supports full-text search with BM25 scoring and inverted indexes, allowing for keyword-based document retrieval.
  • Hybrid Search Capabilities: Enables combining both vector and text search for more comprehensive and relevant results.
  • Efficient Data Loading: Utilizes Apache Doris's StreamLoad HTTP API for high-performance bulk data insertion, optimizing the indexing process.
  • Connection Management: Includes a thread-safe connection pool for managing database connections, ensuring efficient resource handling and scalability.
  • Comprehensive Configuration and Setup: Introduces a dedicated configuration model (DorisVectorConfig) and a detailed setup guide (DORIS_SETUP.md) for easy integration and deployment.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Apache Doris as a vector store, which is a significant feature addition. The implementation is well-structured, covering vector search, full-text search, and efficient data loading via StreamLoad. I've provided several suggestions to improve configurability, documentation clarity, and the robustness of the implementation, particularly around Doris-specific settings and the StreamLoad process. Addressing these points will make the integration more flexible and reliable for users with different Doris setups.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Apache Doris as a new vector database option for Dify's RAG system, enabling vector similarity search, full-text search with BM25 scoring, and hybrid search capabilities. The implementation uses StreamLoad for high-performance bulk data loading and includes connection pooling for efficient resource management.

Key Changes:

  • New DorisVector implementation with vector and full-text search capabilities
  • Configuration model with connection pooling support
  • Integration with existing vector factory pattern and database configuration system

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
api/core/rag/datasource/vdb/vector_type.py Added DORIS enum value to VectorType
api/core/rag/datasource/vdb/vector_factory.py Added case for DORIS in vector factory switch statement
api/core/rag/datasource/vdb/doris/doris_vector.py Main implementation including DorisVector class, DorisConfig, DorisConnectionPool, and DorisVectorFactory
api/core/rag/datasource/vdb/doris/__init__.py Module exports for Doris vector database components
api/configs/middleware/vdb/doris_config.py Pydantic configuration settings for Doris connection parameters
api/configs/middleware/__init__.py Integrated DorisVectorConfig into middleware and added 'doris' as DB_TYPE option
DORIS_SETUP.md Comprehensive setup guide with configuration examples and troubleshooting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@crazywoola crazywoola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the errors in the lint and add the tests for this PR accordingly :)

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jan 5, 2026
@crazywoola
Copy link
Member

Please click Resolve if you think those comments are not necessary.

@dataroaring dataroaring force-pushed the doris_vector branch 2 times, most recently from 86f2187 to 4042584 Compare January 12, 2026 20:14
This commit adds Apache Doris as a new vector database option for Dify's RAG system.

Features:
- Vector similarity search using cosine distance
- Full-text search with BM25 scoring and inverted indexes
- Hybrid search combining vector and text search
- High-performance bulk data loading via StreamLoad
- Connection pooling for efficient resource management
- Support for multi-tenant isolation

Components added:
- DorisVector: Main vector database implementation with cleaned code
- DorisConfig: Configuration model with validation
- DorisConnectionPool: Thread-safe connection management
- DorisVectorFactory: Factory for creating Doris instances
- DORIS_SETUP.md: Complete setup guide in English
- Add type annotations to fix mypy errors (pool config dict, params lists)
- Add USE database statement in _get_cursor to ensure database context
- Add _wait_for_table_normal_state method to wait for schema changes
  before creating text index (fixes index creation race condition)
- Extend Redis lock timeout to accommodate schema change waiting
- Update unit tests to account for new USE database statement
@dataroaring
Copy link
Author

Please fix the errors in the lint and add the tests for this PR accordingly :)

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👻 feat:rag Embedding related issue, like qdrant, weaviate, milvus, vector database. size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants