This is a C# console application that monitors specified folders for document changes and allows you to search through the documents using Lucene.NET.
- Monitors specified folders for document changes (additions and modifications)
- Supports multiple document formats:
- Word Documents (.docx)
- PowerPoint Presentations (.pptx)
- Excel Spreadsheets (.xlsx)
- PDF Documents (.pdf)
- Markdown Files (.md)
- Text Files (.txt)
- Email Messages (.eml)
- Full-text search with Lucene.NET
- Real-time indexing of new and modified documents
- Search results ranked by relevance
- .NET 9.0 SDK or later
- Windows OS (for file system monitoring)
-
Edit the
appsettings.jsonfile to specify which folders to monitor:{ "MonitoredFolders": [ "C:\\Path\\To\\Monitor", "D:\\Another\\Folder\\To\\Monitor" ] }If no folders are specified, it will default to monitoring a "Monitor" folder in your Documents directory.
-
Build the application:
dotnet build -
Run the application:
dotnet run -
The application will:
- Create the Lucene index if it doesn't exist
- Start monitoring the specified folders
- Index any existing documents in those folders
-
While the application is running:
- Press
Sto search for documents - Press
Qto quit the application
- Press
The search supports Lucene query syntax. Some examples:
- Simple search:
keyword - Phrase search:
"exact phrase" - Wildcard:
test* - Boolean operators:
AND,OR,NOT - Field-specific search:
filename:reportorcontent:important
- The application uses
FileSystemWatcherto monitor the specified folders for file changes. - When a document is added or modified, it's processed and indexed by Lucene.
- The search functionality uses Lucene's query parser to find matching documents.
- Results are displayed with the filename, modification date, and relevance score.
- The Lucene index is stored in a
LuceneIndexfolder in the application directory. - The application must have read access to the monitored folders.
- For best performance, avoid monitoring folders with a large number of files or very large files.