Created
June 13, 2013 18:55
-
-
Save mattgartman/5776350 to your computer and use it in GitHub Desktop.
Using LINQPad with Sitecore 7 and Solr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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