Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ssinno28/Lucene.Net.IndexProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
ssinno28 committed Nov 21, 2023
2 parents 9612673 + 524cda7 commit 614d7d6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,24 @@ It will need to be wired up with DI like so:
services.AddLuceneProvider();
services.AddLuceneDocumentMapper();

services.AddScoped<ILocalIndexPathFactory, LocalIndexPathFactory>();
services.AddSingleton<ILocalIndexPathFactory, LocalIndexPathFactory>();
```

In the configure app method in the Startup.cs file you will need to set up a config for each index and add the close session middleware:

```c#
varr indexConfigManager = serviceProvider.GetService<IIndexConfigurationManager>();
indexConfigManager.AddConfiguration(new LuceneConfig()
{
BatchSize = 500000,
LuceneVersion = LuceneVersion.LUCENE_48,
IndexTypes = new List<Type>()
{
typeof(BlogPost),
}
});

app.UseMiddleware<CloseIndexSessionMiddleware>();
```

You'll also want to setup a LocalIndexPathFactory class that implements `ILocalIndexPathFactory` and add it as an injected service.
Expand Down

0 comments on commit 614d7d6

Please sign in to comment.