// For complete examples and data files, please go to https://github.com/groupdocs-search/GroupDocs.Search-for-.NET
// Create or load index
Index index = new Index(Utilities.indexPath);
index.AddToIndex(Utilities.documentsPath);
SearchResults results = index.Search(searchString);
foreach (DocumentResultInfo resultInfo in results)
{
if (resultInfo.DocumentType == DocumentType.OutlookEmailMessage)
{
// for email message result info user should cast resultInfo as OutlookEmailMessageResultInfo for acessing EntryIdString property
OutlookEmailMessageResultInfo emailResultInfo = resultInfo as OutlookEmailMessageResultInfo;
Console.WriteLine("Query \"{0}\" has {1} hit count in message {2} in file {3}", searchString, emailResultInfo.HitCount, emailResultInfo.EntryIdString, emailResultInfo.FileName);
}
else
{
Console.WriteLine("Query \"{0}\" has {1} hit count in file {2}", searchString, resultInfo.HitCount, resultInfo.FileName);
}
foreach (DetailedResultInfo detailedResult in resultInfo.DetailedResults)
{
Console.WriteLine("{0}In field \"{1}\" there was found {2} hit count", "\t", detailedResult.FieldName, detailedResult.HitCount);
}
}