Try our conversational search powered by Generative AI!

Excluding all fields

Vote:
 

Hi!

I feel really great using EPiFind, but I would like to optimize the search index by excluding all fields except ones I need.

For example if I have class hierarchy like:

PageData -> SearchablePageData -> BookPageData

PageData -> SearchablePageData -> MoviePageData

PageData -> SearchPageData

So to deal with SearchablePageDatas only I simply add

ShouldIndex(x => false)

convention for PageData and that's cool.

But what if I don't want to index SearchablePageData properies that are inherited from PageData? Of course there is an option to apply ExcludeField convention for all of 'em, but it's kinda many lines ) 

So I wonder if there is any trick like:

SearchClient.Instance.Conventions.ForInstancesOf<SearchablePageData>().ExcludeAllFields().IncludeField(x => x.FieldToSearchFor);

It's not a matter of search, since I can use .InField(x => x.FieldToSearchFor), but of indexing only.

#85457
Apr 25, 2014 12:56
Vote:
 

You can add a [JsonIgnore] decoration to properties you don't want to be sent to and stored in Find.

#85711
May 02, 2014 12:48
Vote:
 

Yes, surely I can use JsonIgnore on page class or ShouldIndex on SearchClient instance, but if I want to exclude every base property except PageName, that may become a bit, hm... unpretty/ So it feels like I miss something very obvious, or just shouldn't care ))

#85783
May 05, 2014 17:04
Vote:
 

I wouldn't care about the built-in content properties being in the index :)

Should be a quite small amount of data and also the packaged Find-libraries might have various dependencies to them when querying and indexing so it's wise to keep them untouched.

#85784
May 05, 2014 17:23
Vote:
 

Your words about dependencies are quite thrilling - I won't touch it then ))

#85816
May 06, 2014 11:12
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.