Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

Any way to exclude certain fields from search?

$
0
0

When having the '.InAllField()' search, how can we exclude certain fields from searching? I always think it's better to have the blacklist approach (Having 'InAllField()'' and then excluding certain fields) than the whitelist approach (Describing which fields to be searched one by one). Because I do not like to define 100s of fields (in the InFields) if I have to only exclude 2 fields.

My implementation is as below,

var result = client.Search<SamplePage>(GetLanguage(LanguageID))
                .For(Query, SearchHelper.QueryStringQueryAction)
                .InFields(x => x.Name, x => x.Content )
                .InAllField()
                // Blah blah
                .GetResult();

Can't we have something similar to below,

var result = client.Search<SamplePage>(GetLanguage(LanguageID))
                .For(Query, SearchHelper.QueryStringQueryAction)
                .InFields(x => x.Name, x => x.Content )
                .InAllField()
                .ExcludeFields(x => x.Field1, x => x.Field2 )// <---Like this 
                // Blah blah   
                .GetResult();

Viewing all articles
Browse latest Browse all 6894

Trending Articles