Skip to content

Instantly share code, notes, and snippets.

@contensis
Created May 20, 2014 14:29
Show Gist options
  • Save contensis/b1211150dcd059f03d41 to your computer and use it in GitHub Desktop.
Save contensis/b1211150dcd059f03d41 to your computer and use it in GitHub Desktop.
How to create a query with a sub query in the Web API Search.
@using Contensis.Framework.Web
@using Contensis.Framework.Web.Search
<h1>Simple Search</h1>
@{
var query = Query.Where("Property_Path").StartsWith("/Products/Books/").OrSubQuery(
SubQuery.Where("Property_Path").StartsWith("/Products/DVDs/").And("MD_ShowInListing").IsEqualTo("1")
);
var nodes = new NodeFinder().Find(query);
}
<ul>
@foreach(var node in nodes)
{
<li>@node.Title</li>
}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment