Search Bar
Search requests
This commit is contained in:
2025-05-03 22:21:11 -04:00
parent 3eac4e619e
commit e223612a08
17 changed files with 191 additions and 69 deletions

View File

@@ -0,0 +1,26 @@
using AobaCore.Models;
using Microsoft.Extensions.Hosting;
using MongoDB.Driver;
namespace AobaCore;
public class AobaIndexCreationService(IMongoDatabase db): BackgroundService
{
private readonly IMongoCollection<Media> _media = db.GetCollection<Media>("media");
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
var textKeys = Builders<Media>.IndexKeys
.Text(m => m.Filename);
var textModel = new CreateIndexModel<Media>(textKeys, new CreateIndexOptions
{
Name = "Text",
Background = true
});
await _media.EnsureIndexAsync(textModel);
}
}