Copied to clipboard

Flag this post as spam?

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


  • Rik Helsen 670 posts 873 karma points
    Sep 21, 2015 @ 07:58
    Rik Helsen
    1

    Lucene index removing items when it has prior published version and new draft

    We have a custom search indexer, that should index "assesments" if they have a published version (and some other conditions).

    When we publish a node it gets indexed fine. Now it appears that it fails whenever we use the "preview" function, the node is removed from my search index. The preview function saves a new Draft version of the node -> So there is an older published version, but the latest version is in draft. My code checks if the current node is published using "p.Published "

      var type = context.Services.ContentTypeService.GetContentType(EuroNcapConsts.ContentTypeAlias.PreAssessment);
                assessments.AddRange(context.Services.ContentService.GetContentOfContentType(type.Id)
                    .Where(
                        p =>
                            p.Published && (!p.ReleaseDate.HasValue || p.ReleaseDate < DateTime.Now) &&
                            (!p.ExpireDate.HasValue || p.ExpireDate > DateTime.Now))
                    .OrderByDescending(p => p.ReleaseDate));
    

    Two questions: - can anyone confirm that this would exclude nodes with a pending draft version, even if you have older published versions? - does anyone know how i can use the "last published version" of a node in this check?

    Kind regards Rik

  • Rik Helsen 670 posts 873 karma points
    Oct 15, 2015 @ 12:20
    Rik Helsen
    0

    This ended up being a bug in our code, adding more filters to when a full rebuild of index was done compared to when an individual item was added to the index....

Please Sign in or register to post replies

Write your reply to:

Draft