Fluent API

Step I: Specify the search Provider

var Searcher = ExamineManager.Instance.SearchProviderCollection["WebsiteSearcher"];

Step II: Create an instance of ISearchCriteria to build our search query

var searchCriteria = Searcher.CreateSearchCriteria(BooleanOperation.Or);

Step III: Chain up the query for this we can use AND OR NOT operator

var query = searchCriteria.Field("nodeName","hello").Or().Field("metaTitle","hello").Compile();
//var query = searchCriteria.GroupedOr(new string[] { "nodeName", "metaTitle"}, "hello").Compile();
var searchResults = Searcher.Search(query);
var noResults = searchResults.Count();

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s