Skip to content

Instantly share code, notes, and snippets.

@mattgartman
Created June 13, 2013 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattgartman/5776350 to your computer and use it in GitHub Desktop.
Save mattgartman/5776350 to your computer and use it in GitHub Desktop.
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