November Happy Hour will be moved to Thursday December 5th.

Per Nergård
Jan 24, 2014
  2078
(1 votes)

Search and property with backing type

I guess that everybody is familiar with the custom property for editing the metakeyword property in the Alloy templates.

I assume that there are at least a few EPiServer 7 sites out there that uses it, and also doesn’t use Find or any other soution for handling search.

We discovered that if using that custom property which is nice for the editors, have the drawback that the keywords entered isn’t searchable (I guess it doesn’t get indexed) even if you decorate the property with the [Searchable] attribute.

Luckily it’s an easy fix. Just override the ToString method in the backing type like below and the keywords will be searchable.


public override string ToString()
{
    if (Value != null)
        return string.Join(",", List);
    else
        return string.Empty;
}

Jan 24, 2014

Comments

Santosh Achanta
Santosh Achanta Feb 17, 2014 02:01 AM

Good one, thanks Per!

Santosh Achanta
Santosh Achanta Feb 18, 2014 12:01 AM

Good to have a null check before joining otherwise, when you try to publish a page that has meta keywords empty, will throw null reference exception.

Feb 18, 2014 08:40 AM

@Santosh: I thought I hade published the code with the null check that I added. Blog post updated.

Gayathri Saravanan
Gayathri Saravanan Mar 18, 2014 04:00 PM

Good idea...

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog

I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog

Recraft's image generation with AI-Assistant for Optimizely

Recraft V3 model is outperforming all other models in the image generation space and we are happy to share: Recraft's new model is now available fo...

Luc Gosso (MVP) | Nov 8, 2024 | Syndicated blog