سؤال

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