Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Henry 21 posts 141 karma points
    Oct 01, 2015 @ 13:39
    Henry
    0

    Indexing / Searching Leblender grid editor content.

    I've managed to get search working for the umbraco grid by following this tutorial: https://gist.github.com/abjerner/bdd89e0788d274ec5a33. Why this functionality is not umbraco core I don't know but anyway...

    Unfortunately at the moment it only indexes content stored in rte's.

    It does not index content stored in an rte within a custom grid editor. I was wondering if anyone could give me some pointers of how to extend my ExamineIndexer class to also include this.

    Many thanks :)

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Oct 01, 2015 @ 13:51
    Nik
    1

    I did something like this not so long ago. You will need to create your own classes for parsing your custom grid editors and work your way down the JSon tree of data. The more nested controls the more complex it can become.

    I was involved in creating one that indexed an accordion grid editor control which could have an unlimited number of accordion cells in it.

    I used that exact code example as my base.

    To start with create your own classes that inherit from GridControl which I believe is the name of the base class from LeBlender.

  • Henry 21 posts 141 karma points
    Oct 02, 2015 @ 09:47
    Henry
    0

    Hi thanks for the pointer, I'm a bit stuck - bit of a c# beginner to be honest.

    I've got a grid editor with the alias 'cardPopup'

    I've implemented a class: GridControlCardPopupValue

    using Newtonsoft.Json;
    using Skybrud.Umbraco.GridData.Interfaces;
    
    public class GridControlCardPopupValue : IGridControlValue {
    
        [JsonProperty("caption")]
        public string Caption { get; set; }
    
        [JsonProperty("content")]
        public string Content { get; set; }
    
    }
    

    And initialized it at startup

    using Umbraco.Core;
    using Newtonsoft.Json.Linq;
    using Skybrud.Umbraco.GridData;
    
    public class GridStartup : ApplicationEventHandler {
    
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) {
    
            GridContext.Current["cardPopup"] = token => token.ToObject<GridControlCardPopupValue>();
    
        }
    
    }
    

    But it's throwing up

    CS0535: 'GridControlCardPopupValue' does not implement interface member 'Skybrud.Umbraco.GridData.Interfaces.IGridControlValue.Control'

    I tried changing to implement like so:

    public class GridControlCardPopupValue : Skybrud.Umbraco.GridData.Interfaces.IGridControlValue.Control {
    

    but it throws up: The type name 'Control' does not exist in the type 'Skybrud.Umbraco.GridData.Interfaces.IGridControlValue'

    Am I heading in the right direction?

  • Claushingebjerg 936 posts 2571 karma points
    Oct 02, 2015 @ 13:24
    Claushingebjerg
    1

    Have you considered the Full Text Search package?

    It searches the actual content of the rendered page. I've used it on a couple of sites using the grid and Archetype with good results.

    https://our.umbraco.org/projects/website-utilities/full-text-search

  • Henry 21 posts 141 karma points
    Oct 02, 2015 @ 13:27
    Henry
    0

    Thank you this looks perfect!

  • schlubadub 102 posts 617 karma points
    Nov 12, 2015 @ 06:26
    schlubadub
    0

    +1 for Full Text Search. It was the only thing that was able to provide search functionality properly. The out-of-the-box stuff is woefully behind in terms of supporting grid content

Please Sign in or register to post replies

Write your reply to:

Draft