Files
landing_page/qdrant-landing/content/documentation/frameworks/solon.md
T
Anush 08c316fe96 docs: Dagster.io, Solon integrations (#1533)
* docs: Dagster integration

Signed-off-by: Anush008 <anushshetty90@gmail.com>

* docs: Solon

Signed-off-by: Anush008 <anushshetty90@gmail.com>

* Update dagster.md

---------

Signed-off-by: Anush008 <anushshetty90@gmail.com>
2025-04-15 18:20:05 +05:30

2.5 KiB

title
title
Solon

Solon

Solon is a lightweight, high-performance Java enterprise framework designed for efficient, eco-friendly development. It enhances concurrency, reduces memory usage, speeds up startup, minimizes packaging size, and supports Java 8 to Java 23, offering a flexible alternative to Spring.

Qdrant is available as a component in Solon-AI for efficient vector indexing and retrievals.

Installation

<dependency>
    <groupId>org.noear</groupId>
    <artifactId>solon-ai-repo-qdrant</artifactId>
</dependency>

This is the main extension plugin for solon-ai, which provides the QdrantRepository knowledge base.

Configuration

When using QdrantRepository, an embedding model needs to be configured.

solon.ai.embed:
  bgem3:
    apiUrl: "http://127.0.0.1:11434/api/embed"
    provider: "ollama"
    model: "bge-m3:latest"
    
solon.ai.repo:
  qdrant:
    host: "localhost"
    port: 6334
    useSsl: false

You can now instantiate the embedding model and Qdrant.

@Configuration
public class DemoConfig {
    
    // Create the embedding model
    @Bean
    public EmbeddingModel embeddingModel(@Inject("${solon.ai.embed.bgem3}") EmbeddingConfig config) {
        return EmbeddingModel.of(config).build();
    }
    
    // Configure the QdrantClient using QdrantGrpcClient
    @BindProps(prefix = "solon.ai.repo.qdrant")
    @Bean
    public QdrantClient qdrantClient(@Value("${solon.ai.repo.qdrant.host}") String host, 
                                     @Value("${solon.ai.repo.qdrant.port}") int port, 
                                     @Value("${solon.ai.repo.qdrant.useSsl}") boolean useSsl) {
        return new QdrantClient(
                QdrantGrpcClient.newBuilder(host, port, useSsl).build()
        );
    }
    
    // Initialize the Qdrant knowledge base
    @Bean
    public QdrantRepository repository(EmbeddingModel embeddingModel, QdrantClient client) {
        return new QdrantRepository(embeddingModel, client);
    }
}

Usage

@Component
public class DemoService {
    @Inject
    private QdrantRepository repository;
    
    // Add documents to the repository
    public void addDocument(List<Document> docs) {
        repository.insert(docs);
    }
    
    // Search for documents based on a query
    public List<Document> findDocument(String query) {
        return repository.search(query);
    }
}

Next steps