This post will be a little esoteric. I’m working on a Sitefinity project, and one of the features we wanted to implement was the built in site search module.
After configuring the search module everything appeared to be working properly, but after looking a little closer we realized that none of our site content was being indexed. The only thing that was being indexed was each page’s meta tags. I found out in one of the Sitefinity forums that you can control what gets indexed on the site by using an XML configuration file. You can find your site’s configuration file in this path: /%AppDirectory%/App_Data/Search/%IndexName%/fieldsInfoProvider.xml
Here is what the file looks like when you set up a new index:
Here’s what the attributes mean:
name= This attribute is for the reader. You can name it whatever you want.
weight= Gives weight to the content in the search results. (Eg: Items weighted higher will return higher in the search results than lesser weighted items)
indexAttribute= Use this attribute to index all tags with a certain attribute.
filterTag= Use this to tell Sitefinity that you want to index by tag name.
filterAttributes= Use this to filter the attributes by value.
In the site I am building, I want an entire HTML node to be indexed it happens to be:
<div id=”primary”></div>
So to add this content to my index, I added a field node in the fieldsInfoProvider.xml file as such:
If I wanted to add a HTML node by class, I could have changed the filterAttributes= attribute to “class:someCSSClass”. If my HTML node was a <UL>, I’d change filterTag= “UL”.
0 comments:
Post a Comment