excluding elements from search

Topics: Customizing Orchard, Troubleshooting, Writing modules, Writing themes
May 27, 2016 at 1:01 AM
We have content items like a page, using layouts, and the users love being able to have elements to drag into the item. For example we have some html elements that look like navigation that a user can drag onto their page and use. they love it. the problem is the elements are now in the body of the page and return search hits. How can we exclude the elements from the search?
May 27, 2016 at 10:25 AM
That's an interesting scenario that we haven't thought of.
Perhaps instead of rendering the layout into a string for indexing, it's better to let each element control how it is added to the index. The navigation element for example would then be skipped.

Another solution could be to render the layout using different display type when being indexed. That way each element is indexed by default, but we can provide a special view template for elements that should not be index (e.g. navigation).

In any case, there's currently no way that I can think of to skip those elements from being indexed.
Please feel free to create an issue.
May 27, 2016 at 4:18 PM