I want to be able to search just within a certain directory. E.g. lets say a user has clicked the "different types of trains" link at the top of a web site. This page then has a list of different types of trains with a search box. I want anything the user types in the search box just to search the pages within "types of trains" section -- anything within /sitecore/content/LOTW/Home/trains and no other pages on the site. I'm currently using:
protected void searchIcon_Click(object sender, EventArgs e)
{
PerformSearch();
}
private void PerformSearch()
{
/* Changed from Shared Source, to use different path finding, and context database */
Item pointerItem = Sitecore.Context.Database.SelectSingleItem("/sitecore/content/LOTW/Global/Settings/Config/Pointers/Search Results");
if (pointerItem != null)
{
Item results = Sitecore.Context.Database.GetItem(new ID(pointerItem["Item"]));
if (results != null)
{
string results_url = LinkManager.GetItemUrl(results) + "?search=" + Server.UrlEncode(search.Text);
Response.Redirect(results_url);
}
else
{
search.ForeColor = Color.Red;
search.Text = "Unable to find results item";
}
}
}
This instead searches the whole site. I don't really know anything about the search in Sitecore so I'm a little lost!