An ASP.NET Core application that integrates with Weaviate vector database, featuring a wizard-style UI for managing book collections.
- Step 1: Connection & Configuration - Connect to Weaviate with custom URL, API key, and headers (including OpenAI API key for generative search)
- Step 2: Schema Creation - Create the Book collection in Weaviate
- Step 3: Data Import - Import up to 100 books from the provided CSV file
- Step 4: Search - Search books using:
- Similarity (Vector search)
- Keyword (BM25)
- Hybrid (Combined vector + keyword)
- Generative (RAG with OpenAI)
- .NET 8.0 SDK
- A Weaviate instance (cloud or local)
- (Optional) OpenAI API key for generative search
-
Restore dependencies:
dotnet restore
-
Run the application:
dotnet run
-
Open your browser: Navigate to
https://localhost:5001orhttp://localhost:5000
- Enter your Weaviate URL:
- Cloud:
my-cluster.weaviate.cloudorhttps://my-cluster.weaviate.cloud - Local:
localhost:8080orhttp://localhost:8080 - Scheme (http:// or https://) is optional - defaults to https:// if not provided
- Cloud:
- Enter your Weaviate API key (optional for localhost without authentication)
- (Optional) Add additional headers:
- Key:
X-OpenAI-Api-Key - Value: Your OpenAI API key (required for Generative search)
- Key:
- Click "Connect & Test"
Click "Create Book Collection" to create the schema in Weaviate.
Click "Import Data" to load the first 100 books from books.csv.
- Enter your search query
- Select a search mode:
- Similarity: Vector-based semantic search
- Keyword: BM25 keyword search
- Hybrid: Combined vector and keyword search
- Generative: RAG-based search with AI-generated summaries (requires OpenAI API key)
- Click "Search" to view results
WeaviateBookstore/
├── Controllers/
│ └── WeaviateController.cs # API endpoints
├── Models/
│ └── Book.cs # Data models
├── Pages/
│ ├── Index.cshtml # Main wizard UI
│ ├── Index.cshtml.cs # Page model
│ └── _ViewImports.cshtml # View imports
├── Services/
│ └── WeaviateService.cs # Weaviate integration logic
├── wwwroot/
│ └── css/
│ └── site.css # Styling
├── books.csv # Sample book data
├── Program.cs # Application entry point
└── WeaviateBookstore.csproj # Project file
The application does NOT use appsettings.json for Weaviate configuration. Instead, it:
- Accepts connection details from the UI
- Creates a
WeaviateClientinstance dynamically - Stores the client in memory keyed by session ID
The import is strictly limited to 100 rows as specified in the requirements.
The Book collection uses the following vectorized fields:
- Title
- Authors
- Publisher
Each search mode uses the appropriate Weaviate C# client method:
- Similarity:
Query.NearText() - Keyword:
Query.BM25() - Hybrid:
Query.Hybrid() - Generative:
Generate.NearText()with single prompt
- ASP.NET Core 8.0 (Razor Pages)
- Weaviate C# Client
- CsvHelper for CSV parsing
- Vanilla JavaScript for UI interactions
- The UI follows a dark-themed accordion/wizard design
- Steps are enabled sequentially after successful completion of previous steps
- Session state is used to maintain the Weaviate client across requests
- All Weaviate client syntax follows the examples from the
/syntaxdirectory