diff --git a/ExamineDB.sln b/ExamineDB.sln index d60eff3..cfa4549 100644 --- a/ExamineDB.sln +++ b/ExamineDB.sln @@ -7,6 +7,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExamineDB", "src\ExamineDB\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExamineDB.UmbracoTest", "ExamineDB.UmbracoTest\ExamineDB.UmbracoTest.csproj", "{B5818421-4A75-4D81-860F-7BCE15C64047}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{8C0049DA-605E-4A81-90C3-68CEA202A1D0}" + ProjectSection(SolutionItems) = preProject + NuGet\ExamineDB\examinedb.nuspec = NuGet\ExamineDB\examinedb.nuspec + NuGet\ExamineDBUmbracoTester\examinedb.umbracotester.nuspec = NuGet\ExamineDBUmbracoTester\examinedb.umbracotester.nuspec + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/README.md b/README.md index a494f09..461f577 100644 --- a/README.md +++ b/README.md @@ -1 +1,89 @@ -# ExamineDB \ No newline at end of file +# ExamineDB +ExamineDB allows you to index SQL server data using examine based on a defined query in the configuration. Examine is much faster to query than SQL server so it improves the speed of your website. + +##Install## + +Simply install Examine DB by NuGet command "**Install-Package ExamineDB**" + +## Configuration ## +To configure Examine DB add the following configuration snippets to the Examine config files. + +### ExamineIndex.config ### + +Add the following configuration snippet to your ExamineIndex.config. + + + +### ExamineSettings.config ### + +Configure the indexer by the following snippet + + + +####Configuration attributes explained#### + +- Indexset, correspondents with the IndexSet we configure in ExamineIndex.config +- nodeType, sets the nodeType +- connectionStringName, correspondents with the configured connectionstring defined in web.config. This connectionstring will be used to retrieve the data. +- sql. The SQL statement that we use to get all the data. +- singleRecordSQL. The SQL used to retrieve a single record form the database. Make sure the primary key parameter is passed in as @0 and make sure to retrieve the same columns as the normal sql statement. +- primaryKeyField. The column in the results that contain the primary key value. + +Configure the searcher by the following snippet + + + +##Usage## + +Once you configured the indexer correctly and the index contains items you can query the index using the Examine API. See the [Examine documentation](https://our.umbraco.org/documentation/reference/searching/examine/) for full API syntax. + + @{ + var searcher = ExamineManager.Instance.SearchProviderCollection["DBSearcher"]; + var searchCriteria = searcher.CreateSearchCriteria(); + var query = searchCriteria.Field("Name", "paint").Compile(); + var searchResults = searcher.Search(query); + +
    + @foreach (var item in searchResults) + { +
  • @item.Fields["Name"]
  • + } +
+ + } + +##API## +ExamineDB comes with a small management API to rebuild a complete index, or part of the index. + +###Rebuild a complete index### + ExamineDB.Helpers.IndexHelper.RebuildIndex("IndexName here"); + +###Remove a single item from the index### + ExamineDB.Helpers.IndexHelper.DeleteFromIndex("Id here", "IndexName here"); + +###Re-index a single node### + ExamineDB.Helpers.IndexHelper.DeleteFromIndex("Id here", "IndexName here"); + +## Test in Umbraco ## + +The Examine DB Umbraco tester comes with a dashboard control that allows you to use the above API. +Simply install Examine DB UmbracoTester by NuGet command "**Install-Package ExamineDB.UmbracoTester**" + +After install you need to add the following snippet to dashboard.config file + +
+ + developer + + + + ~/app_plugins/examinedb/backoffice/dashboard.html + + +
diff --git a/src/ExamineDB/ExamineDB.csproj b/src/ExamineDB/ExamineDB.csproj index 6623674..074f28f 100644 --- a/src/ExamineDB/ExamineDB.csproj +++ b/src/ExamineDB/ExamineDB.csproj @@ -205,7 +205,13 @@ - XCOPY "$(ProjectDir)bin\$(ConfigurationName)\ExamineDB*.dll" "F:\sites\$(ConfigurationName)\bin\" /y + XCOPY "$(ProjectDir)bin\$(ConfigurationName)\ExamineDB*.dll" "F:\sites\$(ConfigurationName)\bin\" /y +if /I "$(ConfigurationName)" == "Release" XCOPY "$(ProjectDir)bin\$(ConfigurationName)\ExamineDB*.dll" "$(SolutionDir)\NuGet\ExamineDB\lib" /y + +if /I "$(ConfigurationName)" == "Release" DEL "$(SolutionDir)\nuget\ExamineDB\ExamineDB*.nupkg" /Q +if /I "$(ConfigurationName)" == "Release" NUGET PACK "$(SolutionDir)\nuget\ExamineDB\ExamineDB.nuspec" +if /I "$(ConfigurationName)" == "Release" XCOPY "$(ProjectDir)bin\$(ConfigurationName)\*.nupkg" "$(SolutionDir)\nuget\examinedb\" /y +if /I "$(ConfigurationName)" == "Release" DEL "$(ProjectDir)bin\$(ConfigurationName)\*.nupkg" /Q