Try our conversational search powered by Generative AI!

Search Image Data based on Tags in the Editor mode


I have a property named Tags which is a list of strings on my ImageData. When in CMS editor mode (in the Media tab), searching for Image with a name, the result comes up as expected. I want to be able to search for the images based on Tags.

I tried creating an Initializable module and added a property for Find where in I am converting the list of strings to delimeterd string so it can be indexed.

            var findClient = context.Locate.Advanced.GetInstance<IClient>();
            .IncludeField(f => f.TagsAsString())

And in the function TagsAsString() am converting the list of strings to delimetered string. I can also see this property available in the Find index but when searching with the tag , it doesn't pull up anything. 

Any inputs on how I can achieve this.

Edited, Nov 17, 2022 20:48

If you put the full property value in the search term are your results returned

i.e. Search for "Tag1, Tag2, Tag3" 

Another thing to try is wrapping the Search Term in Asterix 

                searchContext = searchContext.For(WrapInAsterisks(query.SearchTerm))
                  .InField(x => x.PageName)
                  .InField(x => x.ExternalTitle)
                  .InField(x => x.RoleLabel)
                  .InField(x => x.JobDescription)

        public static string WrapInAsterisks(string input)
            return string.IsNullOrWhiteSpace(input) ? "*" : $"{input.Trim().Trim('*')}*";
Edited, Nov 17, 2022 22:18
Dileep D - Nov 18, 2022 14:14
Hello Minesh,
Thanks for the response. I am looking to implement this on the editor side of search not the front end side of application.

Found that, all I had to do is to add Searchable attribute on the Tags property. No need of any custom field and indexing.

Nov 21, 2022 18:28
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.