Below is my code to search for a keyword
using ( ClientContext clientContext = new ClientContext ( new Uri ( "https://company.sharepoint.com/sites/records/" ) ) )
{
clientContext.Credentials = Credentials;
KeywordQuery keywordQuery = new KeywordQuery ( clientContext );
keywordQuery.QueryText = "SharePoint";
keywordQuery.TrimDuplicates = false;
// additional properties for keywordQuery which limit the results to particulat document library
SearchExecutor searchExecutor = new SearchExecutor ( clientContext );
ClientResult<ResultTableCollection> results = searchExecutor.ExecuteQuery ( keywordQuery );
clientContext.ExecuteQuery ( );
ResultTable resultTable = results.Value.FirstOrDefault ( );
}
I could barely find any working examples over the internet which restricts the results to only one particular document library.