Frage

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.

War es hilfreich?

Lösung

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

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top