Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using LINQPad with Sitecore 7 and Solr
// IoC container
public IWindsorContainer container;
public class Test :SearchResultItem
{
public ItemUri Uri {get;set;}
public string Testing {get;set;}
}
void Main()
{
//manually wireup Castle.Windsor
container = (IWindsorContainer) new WindsorContainer();
new Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorSolrStartUp(container).Initialize();
//standard sitecore searching with LINQ
var index = ContentSearchManager.GetIndex("sitecore_master_index");
using (var context = index.CreateSearchContext())
{
Console.WriteLine(
context.GetQueryable<Test>().Where(i => i.Name == "Home"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment