Вопрос

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