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?
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....
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 "
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
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....
is working on a reply...