If you don’t find the property you are looking for in the list you need to add
it to the list.
You can define that only site columns become a
managed property. To do so, go to “Crawled Properties” and find your property
(column) in the list (if it’s a site column it will be under the SharePoint
folder).
Enter the property and verify that the “Include
in Index” checkbox is checked. If not, check this option and run Incremental
Crawl to see this property in your scope. Afterwards go once more to the
"Metadata Property Mappings” page and create a new managed property.
Add mapping to the crawled property you created
before and allow this property to be used in scopes. Now you can use this
property in all search scopes.
Contextual Search Scope
Sometime you will see a scope named “This Site”
or “This List”. These names signify that within the search scope there is a
contextual search scope added by SharePoint.
This is a useful option when you want to enable
your users to search only in the area they are working in at the time of their
search (why waste precious time crawling other locations if you know that what
you are searching for is somewhere within your current location?).
If you want to remove an existing contextual
scope you may find this post useful:
http://littletalk.wordpress.com/2008/10/23/removing-contextual-this-sites-cope-from-simple-search-box/
If you like and use this function and you
customized your search results page you may encounter some problems. You can’t
really tell the contextual search scope to send a query to a customized results
page. Contextual search scope always uses a default results page - _layouts/osssearchresults.aspx.
You can customize this page but if you have more
than one SharePoint Portal the correct thing to do is to redirect your user to
the appropriate, customized search results page. When the user types a search
query and presses “Go” the search page redirects the query to the results page
using URL parameters. In the address bar of the results page you can see
parameters like “k”(search query) and “u”(URL). You need to redirect users from
osssearchresults.asx page to customized results page using the same parameters.
The "u” parameter can be indicator, pointing to the site from which the search
query originated.
Below is code that will help you perform the
redirection:
function getParam( name )
{
name =
name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ) return "";
else return results[1];
}
function redirectTo()
{
urlTmp=getParam("u");
if(urlTmp.indexOf("site1url")>0)
{
window.location="http://customresultspageurl.aspx?k="+getParam("k")+"&cs="+getParam("cs")+"&u="+getParam("u");
}
}
redirectTo();
Just replace the “site1url” and
“customresultspageurl” with your values and put this code into the
osssearchresults.asx.
|