Copied to clipboard

Flag this post as spam?

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


  • Christoffer Frede 30 posts 140 karma points
    Sep 28, 2023 @ 13:50
    Christoffer Frede
    0

    searching nested blocklist content in examine search ?

    Hi everyone. i have implemented content modules for a website running Umbraco V11. The content modules is created using blocklists and there is nested blocklists as well for some of the items. I am trying to implement a searchpage that also includes searching the nested content blocklist items text fields.

    i have implemented a basic search using the official documentation and it is working, but is only working on Page properties like Page bodyText. All the content in the blocklist of the page is not indexed or available.

    i dont see anything in the documentation about searching nested content, but if anyone could give me some hints on how to solve this would be great.

    here is a codesnippet form SeachContentNames function in my searchService:

    public IEnumerable<IPublishedContent> SearchContentNames(string query) {
         IEnumerable<string> ids = Array.Empty<string>();
         var textFields = new[] { "nodeName", "description", "content"};
         if (!string.IsNullOrEmpty(query) && _examineManager.TryGetIndex("ExternalIndex", out IIndex? index)) {
             ids = index
                 .Searcher
                 .CreateQuery("content")
                 .NodeTypeAlias("page")
                 .Or()
                 .NodeTypeAlias("home")
                 .And()
                 .Field("nodeName", query)
                 .Execute()
                 .Select(x => x.Id);
         }
    
         foreach (var id in ids) {
             yield return _umbracoHelper.Content(id);
         }
     }
    
  • Marshall Penn 79 posts 260 karma points
    Jan 31, 2024 @ 11:42
    Marshall Penn
    0

    Hi there, today i have noticed that Examine, at least in U13, is not indexing block lists. It seems really strange as afaik it has always indexed block lists and nested content, grid editor etc in the past to my knowledge.

    My solution is going to be to add a label property in the page that is populated on a "publishing" event - a bit like this solution here on DevTo

    https://dev.to/jemayn/indexing-blocklist-data-in-umbraco-9-334o

    Its very annoying as it will add processing time when publishing, plus IPublishedContent/cache will be swelled by the duplication of all the text content.

Please Sign in or register to post replies

Write your reply to:

Draft