Owen
Owen

Reputation: 4407

Setting up Umbraco Indexes

I've created a site using Umbraco 6.02, and I'm going over all the final configuration of the site now, and I've come to indexes. I've done some research, but I just cant find in simple terms what I need to include in each section and why.

Which fields I should include in the <IndexUserFields> section of the index? Is it just the fields I'll be using to search with, for example:currentNode.Children(x => x.bodyText.Contains("*"))? Or fields that I'll be using to sort nodes such as a date field for news articles? Or is there more to it than that?

Which document types do I need to put in the <IncludeNodeTypes> section and the <ExcludeNodeTypes> section and why?

And do I add my fields to one of the already created indexes, or do I create my own?

Upvotes: 2

Views: 3099

Answers (1)

Rob Scott
Rob Scott

Reputation: 8049

Old post but may help someone along the way.


http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx

You can create custom indexes (if you desire) to lock down what types of searching you're doing. Many times you have a search box somewhere on your page and you only want to search certain doc types and their related content.

Keep in mind that you can create NEW index sets, but remember that you'll need to register them in the Config/ExamineSettings.config file as well as the Config/ExamineIndex.config file.

The link above is how I got mine to work correctly for just searching (2) different doc types (which Examine uses as NodeTypes) in the config.

The settings below were created using the already default ExternalIndexer, not a newly created custom one.


The file that you want to edit is in Config/ExamineIndex.config. The set that you want to edit is the ExternalIndexSet (by default). The path will point to the external temp folder

  <IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/">

For fields, that goes in the IndexUserFields section, which are custom properties that you have defined on your doc types

<IndexUserFields>
  <add Name="itemNumber" />    <-- custom property
  <add Name="productName" />   <-- custom property
</IndexUserFields>

The doc types (NodeTypes) that you want are whatever you named your document types. Remember that these are the alias, not the name

<IncludeNodeTypes>
  <add Name="Product" />  <-- document type
  <add Name="Variant" />  <-- document type
</IncludeNodeTypes>

Remember after setting this up you want to re-index your Examine. You can get to this by logging into the backend of Umbraco and going to Developer, then clicking on the tab that says Examine Management.

Please note that the interface is Umbraco 7 but the config file will still be applicable for v6.

enter image description here

Upvotes: 7

Related Questions