https://github.com/gabisonia/lucenesearchexample
Lucene.Net Search Example on .Net Core
https://github.com/gabisonia/lucenesearchexample
documentsearch lucene lucene-net netcore search
Last synced: 9 months ago
JSON representation
Lucene.Net Search Example on .Net Core
- Host: GitHub
- URL: https://github.com/gabisonia/lucenesearchexample
- Owner: gabisonia
- Created: 2017-10-16T21:41:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-16T06:22:23.000Z (almost 2 years ago)
- Last Synced: 2025-04-10T19:50:45.738Z (about 1 year ago)
- Topics: documentsearch, lucene, lucene-net, netcore, search
- Language: C#
- Homepage:
- Size: 11.7 KB
- Stars: 6
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LuceneSearchExample
A refreshed Lucene.Net sample targeting .NET 8.0. The console app demonstrates how to build and query a Lucene index, while the integration tests exercise the flow end-to-end using Testcontainers and PostgreSQL.
## Requirements
- .NET 8 SDK (see `global.json`)
- Docker (required for the Testcontainers-powered integration tests)
## Getting Started
```bash
# Restore dependencies
dotnet restore
# Run the console sample
DOTNET_ENVIRONMENT=Development dotnet run --project src/LuceneSearchExample.App
```
The console application writes the temporary Lucene index location to stdout and prints matching users for a sample query.
## Testing
The integration tests spin up a PostgreSQL container, pull sample users into the Lucene index, and assert the expected match.
```bash
dotnet test
```
If Docker is not available, either skip the tests or mark the `SearchServiceIntegrationTests` class with your preferred test trait filter.
## Project Layout
- `src/LuceneSearchExample.App` – Console host that drives the demo workflow.
- `src/LuceneSearchExample.Search` – Reusable library that wraps Lucene.Net index creation and querying.
- `tests/LuceneSearchExample.IntegrationTests` – xUnit-based tests using Testcontainers and PostgreSQL for realistic data setup.
## Additional Resources
- [Lucene.Net Documentation](https://lucenenet.apache.org/)
- [Testcontainers for .NET](https://dotnet.testcontainers.org/)