+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Limiting Search index for page content

Limiting Search index for page content

4 posts, 1 answered
  1. Mark
    Mark avatar
    3 posts
    Registered:
    24 Apr 2009
    09 Nov 2009
    Link to this post
    I'm building a website for a client that wants to prohibit list items from being searched on their site. I've looked through the search indexing interface and only see that certain pages, not certain content on pages, can be toggled on or off for indexing.

    The client has set up a simple list of links to interior pages on different template pages, and when certain words are searched for, the majority of the search results are coming from these lists which is making actual content with these words become buried.

    Is there a way to make certain content on pages not index in the search?

    Thanks a lot for your help.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Nov 2009
    Link to this post
    Hi Mark,

    It is possible to hide certain content from the search indexer.
    When you have finished indexing a new xml file is generated under ~/App_Data/Search/Index name here/
    You should open the xml file generated and add a new filed line to it. In this line you need to set wheight of the index over certain area.

    Example

    <field name="hide" weight="-1" indexAttribute="" filterTag="div" filterAttributes="id:Left" />

    name = some name
    weight = -1 will not be indexed
    weight = 1 will be indexed
    filterTag = we are getting the div
    filterAttributes - we are getting the ID ot the div

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  3. Kevin Pipher
    Kevin Pipher avatar
    91 posts
    Registered:
    30 Nov 2005
    12 Nov 2009
    Link to this post
    Thanks Ivan for this solution. I had a similar problem as Mark. This would be a good article for the KB as it's probably a necessity of most sites to hide certain elements. In the past I had a base page class method which could detect CMS context and hide controls if it was in crawler mode. The xml file definition method you describe is so much easier and keeps the page code cleaner.

    Question - can we filter multiple controls of the same tag type and different class or id attributes with a single XML entry?

    Example:

    Does this:
    <field name="navMenu" weight="-1" indexAttribute="" filterTag="div" filterAttributes="id:navContainer;" /> 
    <field name="footer" weight="-1" indexAttribute="" filterTag="div" filterAttributes="id:footer;" /> 

    Give the same results as:
    <field name="navMenuAndFooter" weight="-1" indexAttribute="" filterTag="div" filterAttributes="id:navContainer;id:footer;" /> 

    I'm limited in what I can test out as our site is very large and indexing takes approximately 10 minutes each time it's run (~ 40000 words / 2000 pages) .

    Thanks,
    Kevin.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Nov 2009
    Link to this post
    Hi Kevin Pipher,

    If the controls are in the same html element or content place holder you can use one field line. The other option is using CmsContext.IsRequestCrawler(this.Context) to check the request when writing your code. We have plans to integrate new UI for the search in Sitefinity 4.0 and it will be good if we manage to add some restrictions for.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 1 answered