Ok an update on this, in the current project I'm working on shared blocks are not being indexed but an older project shared blocks are being indexed (which I would expect based on what I've read). I can't see any obvious differences between the blocks in each project or think of any other setting that may prevent shared blocks being indexed.
Any thoughts?
Tried using conventions to turn it on?
//using EPiServer.Find.Cms.Conventions; ContentIndexer.Instance.Conventions .ForInstancesOf<BlockData>() .ShouldIndex(x => true);
Something like that at application start...
Hi Daniel, I tried that and it made no difference. The project where blocks are being indexed does not have this code either.
As Johan says, check your conventions code.
Do the index job show any errors at all?
If you are using Find version 11.1.2 or 11.1.3 there is an issue with the indexing job which could prevent all items to be indexed.
Did you check in index in admin mode to confirm that they aren't in index? Or just searched for a block? Just to confirm it is the indexing part that is actually the problem and not when you use the client...
Hi, to answer all your questions...
The conventions code is below, note that I am excluding all blocks but then including the block type that I need to be indexed.
private void SetIndexConventions()
{
var indexer = ContentIndexer.Instance;
//nb: default is to index "all CMS content" so we need to exclude what we don't want
//exclude blocks
indexer.Conventions.ForInstancesOf<BlockData>().ShouldIndex(i => false);
//But we need to include this block
indexer.Conventions.ForInstancesOf<BlahBlahDataBlock>().ShouldIndex(i => true);
}
There are no errors in the indexing but it doesn't look like it's indexing everything:
Indexing job [My Website] [content]: Reindexing completed. ExecutionTime: 0 hours 0 minutes 1 seconds Number of contents indexed: 23
Indexing job [Global assets and other data] [content]: Reindexing completed. ExecutionTime: 0 hours 0 minutes 0 seconds Number of contents indexed: 0
I'm using CMS 9.11 with Find version 12.0.0
I've checked in the Find admin console to confirm the blocks are not there (the searching comes once I've got something to search for).
Thanks for all your help so far,
Mark
And if you change it to a one line expression like
indexer.Conventions.ForInstancesOf<BlockData>().ShouldIndex(i => i is BlahBlahDataBlock);
Does that help?
I have other conventions in that method as well but I left them out for brevity, the full method is currently
private void SetIndexConventions()
{
var indexer = ContentIndexer.Instance;
//nb: default is to index "all CMS content" so we need to exclude what we don't want
//exclude for exclude flag
indexer.Conventions.ForInstancesOf<ContentPageBase>().ShouldIndex(i => !i.ExcludeFromSearch);
// Exclude any type of Folder Page (e.g. AdminFolder, Standard Folder).
indexer.Conventions.ForInstancesOf<ContainerBase>().ShouldIndex(i => false);
//exclude all pages inheriting no search
indexer.Conventions.ForInstancesOf<ContentPageBaseNoSearch>().ShouldIndex(i => false);
//exclude images
indexer.Conventions.ForInstancesOf<ImageFile>().ShouldIndex(i => false);
//exclude form element blocks
indexer.Conventions.ForInstancesOf<BlockBase>().ShouldIndex(i => false);
//exclude blocks
indexer.Conventions.ForInstancesOf<BlockData>().ShouldIndex(i => false);
//But we need to include this block
indexer.Conventions.ForInstancesOf<BlahBlahDataBlock>().ShouldIndex(i => i is BlahBlahDataBlock);
}
And the required blocks are not indexed however if I comment out "indexer.Conventions.ForInstancesOf<ContentPageBaseNoSearch>().ShouldIndex(i => false);" the blocks are indexed (although I get an error "An exception occurred while indexing content 1227: Error getting value from 'Parent' on 'Castle.Proxies.BlahBlahDataBlockProxy'. (see log for more information) ")
So I really don't understand why that one convention would prevent blocks being indexed and why would I get that error when they are indexed?
and if you comment out this line?
indexer.Conventions.ForInstancesOf<BlockData>().ShouldIndex(i => false);
Hi,
I would like to index blocks that are not being used anywhere. Is this possible or do the blocks need to be on a page in order to be indexed. If it is possible what do I need to do for this to happen (custom index job?)?
Thanks,
Mark