Posted by : Jebastin Thursday 13 November 2014

Examine allows you to index and search data easily and wraps the Lucene.Net indexing/searching engine. Lucene is super fast and allows for very fast searching even on very large amounts of data. Examine is provider based so is very extensible and allows you to configure as many indexes as you like and each may be configured individually. Out of the box our UmbracoExamine library that is shipped with Umbraco gives you Umbraco based implementations for indexers and searchers to get started quickly.

Configuration:
 
Step 1: Open the ‘ExamineSettings.config’ file from the ‘config’ folder.
 
Step 2: Create a new Index Provider in the ExamineIndexProviders section:

<add name="MyIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"/>

Step 3: Create a new Search Provider in the ExamineSearchProviders section:

<add name="MySearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"/>

Step 4: Open the ‘ExamineIndex.config’ file from the ‘config’ folder.
Create a new Index Set in the ExamineLuceneIndexSets section:

<IndexSet SetName="MyIndexSet" IndexPath="~/App_Data/TEMP/MyIndex" />

Code:
 
@using Examine;
@{
  var searchTerm = Request.QueryString["search"];
}
<ul class="search-results">
  @foreach (var result in ExamineManager.Instance.Search(searchTerm, true))
  {       
    <li>
        <span>@result.Score</span>
        <a href="@umbraco.library.NiceUrl(result.Id)">
            @result.Fields["nodeName"]
        </a>       
    </li>   
  }
</ul>

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Link To This Post/Page

Spread The Word

Add this button to your blog:
JJ Technology Solutions

Blog Archive

Trackers

eXTReMe Tracker
facebook

- Copyright © JJ Technology Solutions - Powered by Source Code Solutions -