Pregunta

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.

¿Fue útil?

Solución

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

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top