Hi Andrea, how does your Search query looks like?
If you have a baseclass for your pagetypes then I would suggest to search for that instead of IContent.Another option, that is not better, but possible is to exclude images to get indexed. The downfall with that is that you can't search for images then if you need to do that later :)
Hi,
You can also use filter in your query to exclude images,
query.Filter(p => !p.MatchTypeHierarchy(typeof(ImageData)))
Hi Guys,
A bit related to this question.... But does anyone has a example of excluding anything of MediaData And ImageData (media files) from being indexed. So only content should be indexed.
It should be in a initializationmodule right?
I would appreciate a nice way to achieve this
Hi,
Yes you should do this in initialization module. You can exclude media data by changing indexing conventions,
ContentIndexer.Instance.Conventions.ForInstancesOf<MediaData>().ShouldIndex(p => false);
OK ik have this initialization module, but still i see these documentTypes in the epi find overview..
Is my module not good.. am i missing something?
ofcourse cleared the index first
[InitializableModule] [ModuleDependency(typeof(EPiServer.Web.InitializationModule))] public class SearchInitialization : IInitializableModule { public void Initialize(InitializationEngine context) { ContentIndexer.Instance.Conventions .ForInstancesOf<ImageFile>() .ShouldIndex(x => false); ContentIndexer.Instance.Conventions .ForInstancesOf<GenericMedia>() .ShouldIndex(x => false); ContentIndexer.Instance.Conventions .ForInstancesOf<TimelinePeriodFolder>() .ShouldIndex(x => false); ContentIndexer.Instance.Conventions .ForInstancesOf<ContentAssetFolder>() .ShouldIndex(x => false); public void Uninitialize(InitializationEngine context) { //Add uninitialization logic } }
Hi, does anyone know how to exclude images from search results? For example, I have images with the word "Cancun" in the file name. When I search "Cancun," those images show up in the search results. In Find > Configure, should I give the Title property less weight?