Installation Instructions

Requirements

Umbraco 4.7 or higher and .NET 4

Pre Installation

Make sure Umbraco is properly set up and configured, and that your database user has rights to create tables (this should certainly be the case if you've gone through the default install procedure). The package creates a table called fullTextCache, you may want to check that doesn't already exist, in the unlikely event that some other package uses that name. Backup your database and files.

Install Package

Download the correct package version for your Umbraco installation. The package version number indicates the minimum compatible Umbraco version number for which the package should be installed. Currently, 3 versions are available:

  • Full_Text_Search_4.7.x.zip for Umbraco 4.7.0 to 4.7.2
  • Full_Text_Search_4.8.x.zip for Umbraco 4.8.0 to 4.11.x
  • Full_Text_Search_6.0.x.zip for Umbraco 6.0.0 to 6.1.2
  • Full_Text_Search_6.1.x.zip for Umbraco 6.1.3 to 6.1.6

Once downloaded, login to Umbraco, go to the developer tab -> packages ->Install local package, upload the file and go through the installation prompts.

Indexing Configuration

There's a few things you'll have to set up for indexing to work.

You'll need to customise the config file at ~/config/FullTextSearch.config . There's a lot of options here, most of which can be ignored for now.

There are a couple of options which need to be correctly set for basic indexing to function.
Firstly, you need to set the correct URL/Hostname for your site in the config file. IIS will need to be able to resolve this URL/Hostname combination to your site. The easiest way to do this is to set the <HttpUrl> to point at default.aspx in your umbraco installations document root. e.g. 

<HttpUrl>http://mysite.com/default.aspx</HttpUrl>

or 

<HttpUrl>http://localhost:8080/default.aspx</HttpUrl>

Alternatively, If you're having problems with name resolution you can set the <HttpHost> field, which sets the host header indpendently of the URL called. e.g. set 

<HttpUrl>http://127.0.0.1/default.aspx</HttpUrl>
<HttpHost>mysite.com</HttpHost>

If required, HttpUrl and/or HttpHost can also be overridden in the web.config by adding the following app settings respectively: FullTextSearchHttpUrl and FullTextSearchHttpHost.

After setting the URL, set <Enabled> to true. There's a lot of other options here, the file is reasonably well commented, and some are described in more detail in the settings and customisation part of this guide.

The package will also automatically add the necessary Umbraco Examine configurations in the ~/config/ExamineSettings.config and ~/config/ExamineIndex.config files. The default settings are basic - if you're familiar with examine feel free to customise to your taste...

These are the settings that will be added:

ExamineSettings.config

Added the following under <providers> in the <ExamineIndexProviders> section 

<add name="FullTextIndexer" type="FullTextSearch.Providers.FullTextContentIndexer, FullTextSearch"
runAsync="true"
supportUnpublished="false"
supportProtected="false"
interval="10"
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
enableDefaultEventHandler="true"
indexSet="FullTextIndexSet"/>

 Note that Full Text Search does not currently support indexing unpublished or protected pages. So leave these settings at false.

Added the following under <providers> in the <ExamineSearchProviders> section 

<add name="FullTextSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
indexSet="FullTextIndexSet"/>

 ExamineIndex.config

Added the following under <ExamineLuceneIndexSets> 

<IndexSet SetName="FullTextIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/FullText/">
	<IndexAttributeFields>
		<add Name="id" />
		<add Name="nodeName"/>
		<add Name="nodeTypeAlias"/>
	</IndexAttributeFields>
	<IndexUserFields>
		<add Name="bodyText" />
	</IndexUserFields>
	<IncludeNodeTypes/>
	<ExcludeNodeTypes />
</IndexSet>

 Feel free to customise these settings to suit your site. Consult the Umbraco examine documentation for the meaning of the various settings. Briefly, "IndexUserFields" tells examine which user fields from the node to add to the index. "ExcludeNodeTypes" allows you to set a list of node type aliases to exclude.

Once you've done that indexing should basically work. You'll need to publish a page on the site to actually add your content to the index, as indexing is triggered on publish events.

There's a lot more settings that control indexing, most of these are detailed in the settings and basic customisation guide. One thing we'd definitely recommend you do is to change all your common macros ( stuff that appears on every page, main navigation, search box, etc. ) so that they don't output on search indexing. That prevents searches for common terms turning up irrelevant results. See the linked guide for more details

If you're having problems with indexing, the following ideas could help with debugging...

  1. Re-create the index by using the full text search tab in the developer section of the back office
  2. Delete the index at ~/App_Data/TEMP/ExamineIndexes/FullText/ and republish to re-create
  3. Use a tool like Luke to examine the index directly
  4. Consult the Umbraco error log in the database. Indexing errors should show up there

Setting up your search form

An actual search page is not added by the package. But a template and a document type ( both alias "FullTextSearchPage") are added to your site.

In order to get a basic search up and running on your site, all you need to do is add a page of type "Full Text Search Page" somewhere underneath your home page. The search form is automatically added to that page by the FullTextSearch macro present in the template. The template is not a complete HTML page, so you'll probably want to put it under whatever master page you're using. In order to have the search results correctly formatted you will also need to reference the FullTextSearch.css stylesheet.

The package adds a FullTextSearch macro and Razor file, this uses helper functions from the FullTextSearch search extenstions to query the Lucene index and return results/errors. The results and errors are then formatted for display by the Razor code.

The only thing that really needs to be present in your template for search to function is the macro FullTextSearch. You may also want to reference the FullTextSearch stylesheet, or copy its contents into your own.

There's a number of macro parameters that control how the search works and what gets output. These are documented in the XSLT file as well as the Settings and basic Customisation section.

If you're supplying search terms from a search box that's not on the search page, supply the search terms as a GET or POST parameter named "Search" (this is editable in the Razor file).

The default HTML for the form should be OK for most purposes, if it doesn't work for you it's entirely editable in the FullTextSearch.cshtml without having to touch any code.

The actual text displayed on the search page("Your search did not match any documents" etc.) is controlled by several dictionary entries, placed under "FullTextSearch" in the dictionary. Currently only English is included. Feel free to edit dictionary entries to your taste. Note that some of them use formatted strings in the c# string.Format style. What this means is that the numbers in curly brackets ( {1} etc. ) are replaced with a variable piece of information. It should be pretty obvious from the text what that info is. Remove these if you don't want/need that info.

Intro

Settings and Basic Customisation

Advanced Customisation

Download

Last edited Oct 14, 2013 at 12:49 PM by governor, version 19

Comments

No comments yet.