Skip to content

Add Apache Solr Integration #792

@Chicoo

Description

@Chicoo

.NET Aspire issue link

No response

Overview

I am using SoIr as a search service for web apps and would like to have an Apache Solr integration as part of the Community Toolkit.
The integration should:

  • start the official Solr Docker Image.
  • provide a way to change the port number.
  • provide a way to add a SolrCore. When referencing the Sorl core in a project is should provide the end point of the Solr core.
  • include WithDataVolume, WithDataBindMount and WithLifetime.

Usage example

To integrate Solr as a hosted resource in a .NET Aspire application:

Install the Aspire.Hosting.Solr NuGet package:

dotnet add package Aspire.Hosting.Solr

Add the Solr container resource in the app host project:

var builder = DistributedApplication.CreateBuilder(args);

// Add Solr resource
var solr = builder.AddSolr("solr");

// Add Solr with custom port
var solrWithCustomPort = builder.AddSolr("solr-custom", port: 8984);

// Add Solr with custom core name
var solrWithCustomCore = builder.AddSolr("solr-core", coreName: "mycore");

// Add Solr with both custom port and core name
var solrCustom = builder.AddSolr("solr-full", port: 8985, coreName: "documents");

// Reference the Solr Core in a project
var exampleProject = builder.AddProject<Projects.ExampleProject>()
                            .WithReference(solrCore);

// Initialize and run the application
builder.Build().Run();

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions