How exclude field from search?

Vote:
 

Hi,

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>()
.For(query)
.ExcludeField(x => x.ChangedBy)
.FilterForVisitor()
.Track()
.GetPagesResult();

#80950
Feb 05, 2014 15:37
Vote:
 

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

http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Find1/75/Integration/EPiServer-75-CMS/Indexing/

#80954
Feb 05, 2014 18:16
Vote:
 

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.

#81027
Feb 07, 2014 11:14
Vote:
 

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(..)

#81031
Feb 07, 2014 11:45
Vote:
 

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?

#81042
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.