Add another property on contenttype that reads from first and returns a string array...?
I think Daniel's suggestion is a viable option, or you could customize the indexing if you don't want to modify your original object: http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/9/DotNET-Client-API/Indexing/
It's amazing how you sometimes don't see the the simple solutions for problems. Thanks for the input! Another property will solve this nicely.
Isn't it...? :)
Extension method for the content type is a slightly more elegant way of doing the same if you don't want to mess with your model btw.
Yes that would probably be a better, I just have to figure out how to set that up with Vulcan.
Solved it for now using the following setup (adding a property on the page object):
[Display( GroupName = GroupNames.TechnicalInformation, Order = 700)] [CategorySelectMany("HouseProperties", SelectionFactoryType = typeof(CategorySelectionFactory))] public virtual string HousePropertiesString { get; set; } public IEnumerable<string> HouseProperties { get { var properties = this.GetPropertyValue(p => p.HousePropertiesString); if (string.IsNullOrEmpty(properties)) return new List<string>(); return properties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } }
Tobias,
You can also add custom fields by implementing an IVulcanIndexingModifier. I've done that to add isSearchable to a page type in a nuget assembly. Here is a sample:
public void ProcessContent(IContent content, Stream writableStream) { if (content == null) return; string searchDescription; GetDescription(content, out searchDescription); // fallback to teaser if (string.IsNullOrWhiteSpace(searchDescription) && content is SitePageData) searchDescription = ((SitePageData)content).Teaser; var streamWriter = new StreamWriter(writableStream); if (!string.IsNullOrWhiteSpace(searchDescription)) streamWriter.Write(",\"" + VulcanFieldConstants.SearchDescriptionField + "\": " + Escape(searchDescription)); // Add IsSearchable if (content is BlogPostData) streamWriter.Write(",\"isSearchable\": true"); streamWriter.Flush(); }
Is there a way to make the values of a SelectMany-attributed property be stored as an string array instead of a string?
We have a soultion which uses VulcanSearch and since the value is stored as "string1,string2,string3" it makes the search in those fileds troublesome. Read that for elasticsearch you can fix this by specifying an analyzer for that field that automatically sperates it by comma but I'm not sure how that would be implemented using the Project Vulcan setup.