Follow the below steps to search by item name
- you just need to add references of the Solr content Seach from visual studio
- Add the below code in your class file as a method
List<SearchResultItem> results;
using (var context = ContentSearchManager.GetIndex(indexName).CreateSearchContext()) { var predicate = PredicateBuilder.True<SearchResultItem>(); // must have this (.and) if you want o query specific path then enable below line //predicate = predicate.And(p => p.Paths.Contains(FolderItem.ID)); // must have this (.and) predicate = predicate.And(p => p.Name == searchTerm); results = context.GetQueryable<SearchResultItem>().Where(predicate).ToList(); } - Finally, Rebuild indexes from Sitecore control panel