The main reason for this PR was to fix errors in creating the index. Index creation was called at the end of the Configure method in the Startup class (after app.UseRouting();). This meant that the incoming request to index the new data could overtake the indexing process, and then Solr automatically created the invalid schema for that data.
Moving this process before app.UseRouting ();, solved this problem.
moved all work with HttpClient to typed client service SolrService
defined typed client with base address and Polly retry policies in the Startup class
migrate from obsolete Newtonsoft to new System.Text.Json serializer
used async/await wherever possible
...
✨ Minor improvements
Improved some logs. For example: if core was not define in docker-compose file, the creating schema failed without reasonable notice. New ====== Solr doesn't contain a definition of core for index{index.Name}. Callprecreate-core {index.Name};in entry point definition of your Solr docker image in docker-compose file. warning is logged.
Check and wait for Solr service in the start of index creating proces (method CheckAndThrowExceptionIfSolrIsNotAvailable).
🪲 Bug Fixes
The main reason for this PR was to fix errors in creating the index. Index creation was called at the end of the
Configure
method in theStartup
class (afterapp.UseRouting();
). This meant that the incoming request to index the new data could overtake the indexing process, and then Solr automatically created the invalid schema for that data.Moving this process before
app.UseRouting ();
, solved this problem.🔨 Refactor
Refactor mainly concerns working with
HttpClient
(follow best practices)HttpClient
to typed client serviceSolrService
Startup
classSystem.Text.Json
serializerasync/await
wherever possible✨ Minor improvements
Improved some logs. For example: if core was not define in
docker-compose
file, the creating schema failed without reasonable notice. New====== Solr doesn't contain a definition of core for index
{index.Name}. Call
precreate-core {index.Name};in entry point definition of your Solr docker image in docker-compose file.
warning is logged.Check and wait for Solr service in the start of index creating proces (method
CheckAndThrowExceptionIfSolrIsNotAvailable
).