London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

ContentIndexer IncludeField or ExcludeField?

Vote:
 

Hi I am trying to use an API documented on http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/12/Integration/episerver-7-5/Indexing/

But the example for "ExcludeField" provided doesn't seem to work with Episerver.Find.Cms 12.2.4

ContentIndexer.Instance.Conventions
  .ForInstancesOf()
  .ExcludeField(x => x.ACL)
The extension method ExcludeField is missing.. Am I missing a using??

Ideally I want to use an .IncludeField(x => x.something) if anyone knows if this also should exist?
#170781
Oct 30, 2016 17:34
Vote:
 

Which usings do you have?

#170783
Oct 30, 2016 21:47
Vote:
 

Hi Johan

I've got:

using EPiServer.Core;
using EPiServer.Find;
using EPiServer.Find.Cms;
using EPiServer.Find.Cms.Conventions;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;

Hopefully it's something easy I've missed :)

Matt

#170786
Oct 31, 2016 0:28
Vote:
 

Oh and I've also added:

using EPiServer.Find.ClientConventions;

But no luck yet..

#170787
Oct 31, 2016 0:32
Vote:
 

Okay, apparently since Epi v7.5 it should be done like this:

EPiServer.Find.Framework.SearchClient.Instance.Conventions.ForInstancesOf<PageData>().ExcludeField(x => x.ACL); // with using EPiServer.Find.ClientConventions;

Not sure why the official documentation suggests otherwise though.

Matt

#170788
Oct 31, 2016 0:44
Vote:
 

OK! Note that it will only be in play on queries. ShouldIndex() is still on ContentIndexer if you want to stop a full IContent to going to the index and I think the recommended approach to not put a property's data in the index is to use the JsonIgnore-attribute.

#170798
Oct 31, 2016 8:22
Vote:
 

Where are you trying to add it?

Could you show us the complete class where it does not work?

#170800
Oct 31, 2016 9:20
Vote:
 

Hi Henrik

It does work with the above code that I marked as the answer.

Matt :)

#171065
Nov 01, 2016 2:04
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.