Skip to content

Commit

Permalink
Final check-in
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoeteman committed Jun 1, 2016
1 parent 0b1f5c7 commit 348db8f
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ExamineDB.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
90 changes: 89 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,89 @@
# ExamineDB
# 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.

<IndexSet SetName="DBIndexerIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/{machinename}/DBIndexer/" />

### ExamineSettings.config ###

Configure the indexer by the following snippet

<add name="DBIndexer" type="ExamineDB.Indexers.DBIndexer, ExamineDB"
indexSet="DBIndexerIndexSet"
nodeType="examineDBProducts"
connectionStringName="examineDBConnection"
sql="SELECT * FROM Production.Product"
singleRecordSQL = "SELECT * FROM Production.Product where productId = @0"
primaryKeyField = "productId"/>

####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

<add name="DBSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" indexSet="DBIndexerIndexSet" />

##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);

<ul>
@foreach (var item in searchResults)
{
<li>@item.Fields["Name"]</li>
}
</ul>

}

##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

<section alias="ExamineDBDashboardSection">
<areas>
<area>developer</area>
</areas>
<tab caption="ExamineDB">
<control>
~/app_plugins/examinedb/backoffice/dashboard.html
</control>
</tab>
</section>
8 changes: 7 additions & 1 deletion src/ExamineDB/ExamineDB.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>XCOPY "$(ProjectDir)bin\$(ConfigurationName)\ExamineDB*.dll" "F:\sites\$(ConfigurationName)\bin\" /y</PostBuildEvent>
<PostBuildEvent>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</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down

0 comments on commit 348db8f

Please sign in to comment.