How to check if a Property is marked as Searchable

by: Allan Thræn

A couple of times I've been asked how to check if a property on a page is set to be Searchable. It can be very handy to know, if you are making a search engine integration - or any other kind of textual processing of EPiServer CMS content, for that matter. And I know I haven't been alone in wondering why it's not exposed on the PropertyData object. However, the answer is simply, that it doesn't belong there. It's a piece of meta-data set on the definition on a property - and not on the property itself. In order words, it's one abstraction level above the PropertyData object.

To get access to the SearchAble, LanguageSpecific, etc properties look at the PageDefinition class - for instance like this:

PropertyData pd = CurrentPage.Property["MainBody"];
bool isSearchable = 
PageDefinition.Load(pd.PageDefinitionID).Searchable;

23 June 2008


Comments

  1. Works like a charm.
Post a comment    
User verification Image for user verification  
Allan Thræn

About me

I'm  a  developer on the Research team, based in the danish EPiServer office. My technical interests is typically focused around search, information management, artificial intelligence, usability in content management and most of all making cool plugins and code samples for EPiServer.

On top of this blog I have the blog Allan On Technology and I plan to crosspost a lot in the future.

 


Syndications


Archive


Tag cloud

EPiTrace logger