


This project aims to explore the operation of Solrnet in the consumption of the Search Engine Solr service in projects. Net core.
After the project clone and follow the steps described in the installation step.
git clone https://github.com/AntonioFalcao/SolrDotnetSample.gitEnvironment is necessary with the following resources:
TO CHECK THIS FUNCTIONALITY:
dotnet --versionFor more details
dotnet --infoTo install:
dotnet tool install --global dotnet-efTO CHECK THIS FUNCTIONALITY:
dotnet-ef --versionTO CHECK THIS FUNCTIONALITY:
docker --versionWith the use of containerization , we can practically provision the necessary infrastructure.
Initially we will use the SOLR service to meet the need for Search Engine through compose ./solr-compose .
docker-compose -f solr-compose.yml up -d The standard index, referred to as Solr Core is defined as my_core in entrypoint , as well as standard port mapping 8983:8983 :
services :
# comment for brevity
ports :
- " 8983:8983 "
entrypoint :
- solr-precreate
- my_core
# comment for brevity The definition of the Fields in the solr is an essential step, to ensure that the data will have the same representation desired by the model.
There are two ways to do so, one of them is to define the details of the Fields in Schema.xml, the other way is to make direct calls to the service API. For the second alternative, there is the Solr-Add-fields.http file available on the project:
POST http://localhost:8983/solr/my_core/schema
Content-Type: application/json
{
"add-field" :{
"name" : " Description " ,
"type" : " string " ,
"stored" : true
},
"add-field" :{
"name" : " Title " ,
"type" : " string " ,
"stored" : true
},
}
### comment for brevity Once provisioned the environment and configured the Fields, we can sow data through the steps:
At this stage the data sowing will occur to the relational DB.
dotnet ef database update -s ./src/SolrDotnetSample.WebApi/ -p ./src/SolrDotnetSample.Repositories/Two options will be available, and
- Generate new data.
- Migrate relational data.
docker build -t seed -f ./consoleApp.Dockerfile . && docker run -it seedUnit and integration tests can be executed with their command:
dotnet test To execute tests functionally, we must initially execute the project to make the web service available.
docker build -t webapi -f ./webApi.Dockerfile . && docker run -p 5000:5000 webapi The routing follows the standard
http://hostname:port/api/v{version}/controller
To make calls, you may be using the ./basic-api-call.http file through the rest client extension, for example:.
/api/v1/...Uses the Relational Database.
/api/v2/...Uses the solr
### V1 - Relational DB
GET http://localhost:5000/api/v1/posts
### V2 - NoSql DB
GET http://localhost:5000/api/v2/posts
### V1 - Relational DB
POST http://localhost:5000/api/v1/posts
Content-Type: application/json
{
"Description" : " Description " ,
"ExpiryDate" : " 2020-01-01 " ,
"IsActive" : true ,
"IsSold" : true ,
"PostDate" : " 2020-01-01 " ,
"Price" : 0 ,
"Title" : " Title "
}
### comment for brevity Details on Treadmill (CI/CD) available in Project Github Actions
AVAILABLE SOON!
We use Semver for Versioning. For the Versions Available, See the tags on this Repository.
See also the List of Contributors Who Participated in this Project.
This project is licensed under the mit license - See the license.md file for details