This is what I have so far

using Sitecore.ContentSearch;
using Sitecore.ContentSearch.Linq;
using Sitecore.ContentSearch.SearchTypes;
using Sitecore.ContentSearch.Linq.Utilities;
using Sitecore.Search;

using (var context = SearchManager.GetIndex(searchIndexName).CreateSearchContext())
{   

}

In the context I don't have a function context.GetQueryable() . Can someone please tell me what am I missing.

有帮助吗?

解决方案

You can try something like:

//Create a Search Context to the "indexname" Index (could be SOLR/Lucene/something else)
using (var context = new ContentSearchManager.GetIndex("indexname").CreateSearchContext()) 
{
 //LINQ Query
 var query = context.GetQueryable<SomeType>.Where(i => i.Name.StartsWith("Something"));

}
//Disposal due to IDisposable

Also you can check this link

其他提示

Your using statement refers to the SearchManager class which is from the Sitecore.Search namespace in Sitecore.Kernel.

You actually need to use the ContentSearchManager class which is from the " Sitecore.ContentSearch namespace in Sitecore.ContentSearch.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top