Try our conversational search powered by Generative AI!

How exclude field from search?



I would like to exclude search from looking into specific fields, for example the "ChangedBy" property

Is there an extension like below available? Or how do I do it properly?


var result = SearchClient.Instance.Search<StandardPage>()
.ExcludeField(x => x.ChangedBy)

Feb 05, 2014 15:37

You can exclude the field for a specific type by using conventions or you can exclude a field in the default search field.

Feb 05, 2014 18:16

Thanks for the reply!

Well, I still want to index it, so no conventions.

Exclude a field in the default search, I am not sure what this is, can you describe? 

I would still like to be able to search in this field at some cases.

Feb 07, 2014 11:14

I think the best way in this case is to use .InField(x => x.PropertyName) to specify which properties you want to search. You could have multiple .InField(..) in a query, or you could use .InFields(..)

Feb 07, 2014 11:45

Well, I am searching in a baseclass over multiple types, I don't want to specify on a pagetype level... the fields I want to search in differ from type to type, but the field I would like to ignore is common for all.

This scenario can not be that unusual?

Feb 07, 2014 13:09
* 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.