Faceted search and scopes

Sep 10, 2008 at 7:00 PM

I'm having trouble to set up the following:
I've created a new scope called "All document libraries" with one required rule 
    contentclass = STS_ListItem_DocumentLibrary

When I try to use the new scope in a search like 
the search core result web part uses the scope, but the search facets web part seems to ignore it.

When I use 
instead both web parts return the same result set.

Does that mean that faceted search can't use scopes or is there something wrong with my setup.



Sep 11, 2008 at 11:37 AM
Hi Rainer,

Many thanks for your comments.

There are currently some on-going discussions about Faceted Search and scopes, and as yet there isn't complete synchronisation between FS and custom scopes.  We will provide updates when some of these issues have bene resolved.

Kind Regards,

Shaun O'Callaghan
Sep 21, 2008 at 1:44 AM
Edited Sep 21, 2008 at 11:33 PM
It seems that the scope is not used in building the query. I have managed to get this working for keyword searches by adding the following to the CustomizeQuery method of the SearchProcessor class.
 if (sender is KeywordQuery)
 ... //added the foolowing
   if (!string.IsNullOrEmpty(_query.Scope))
            string[] scopes = _query.Scope.Split(','); //for multiple scopes i.e. ?s=scope1,scope2
            foreach (string s in scopes)
                        query.HiddenConstraints += string.Format(" +scope:\"{0}\"", s); //make sure "" around scope value to allow for scopes with spaces
The advanced search already uses the scope in the query but I have not tested it a lot since I am really only using faceted web part for keyword queries. The hard work of extracting the scope is all done and works fine it just seems as though it has been left out of the keyword query that gets executed.
Sep 22, 2008 at 1:33 PM

This is great feedback.  Let me test and get back to you.

Sep 23, 2008 at 2:58 PM

Thanks for the information. I hope that it will make it into the final build ;-).

Sep 24, 2008 at 3:00 AM
I've also added a check first thing in CustomizeQuery to get the scope from core results web part as well. There might be better places to do this but I am trying to keep any deviations I make from the release localised and to a minimum. It will only use the core results scope if it is set and no other scope is scpecified. I think this is consistent with core results. I.e. if you add a &s=scope2 where core results is set to use scope1 only scope2 seems to be used. I am not certain about that behaviour though.

  if (string.IsNullOrEmpty(_query.Scope) && !string.IsNullOrEmpty(_coreResultsWebPart.Scope))
        _query.Scope = _coreResultsWebPart.Scope;

Jan 20, 2009 at 7:15 PM
Is this addressed in the Release 3.0 Alpha?
Feb 19, 2009 at 9:38 AM
Thanks for this code caevyn.  It's now working on my system :)

One thing I noticed however is that the Search Action Links are being picked up as Core Results Web Part (I'm not sure if this is supposed to be the case) and the faceted search code returned this as the _coreResultsWebPart.

I've modified faceted search web part to have an extra property for setting the title of the search core results to ensure the correct core results webpart is being assign to _coreResultsWebPart.

Sep 22, 2009 at 2:48 PM


Is there any support for Scopes in current version of FS 3.0?


I've just downloaded and installed Faceted Search One Click Install - Version 3.0.073109.0, created a custom Scope, and expected it to appear in the Facets web part.

But it didn't.

Went back to the start page, and selected the Scope in the dropdown, entered a search word, and hit search. On the result page, the Scopes facet appeared in the bread crumbs, but the result set was a bit off course...


Is this the current support level of Scopes, or this more to it?



Sep 25, 2009 at 3:06 PM
Edited Sep 25, 2009 at 3:07 PM

You have to check if your custom scope processed by the MOSS search engine (updated). The Faceted Search will show you all the scopes that have matching results.

Also, you can set your custom scope on the Facets WP property to limit results to the scope.

Sep 28, 2009 at 8:30 AM

OK, I can see in Search Administration that all my custom scopes is processed and have items.

Am I to understand that the Search Facets Web Part only limits to 1 scope at a time? I was hoping to see all relevant scopes when doing a search.

I.e. when searching from the front page, and selecting the scope "All sites", searching for "docx". When I get the result page up, I would like to see a separate "Scope" section in the Search Facets Web Part telling me which scopes this search has hits within. In my case, it would include "All sites" and "All documents", a custom scope limited to return only items defined as documents. (For more information on how to create such a scope, see http://sharepointsearch.com/cs/blogs/sanjaya/archive/2009/06/12/create-and-configure-a-scope-to-return-only-documents-in-search.aspx.)


Oct 3, 2009 at 8:25 PM

Faceted Search will show all the Scopes associated with search results unless you set a Scope in the Search Facets web part property. Even then you likely get multiple scopes. E.g. All Site by default includes all non-people scopes.

Oct 13, 2009 at 9:18 PM

Is there anyway to have the Scopes show up as facets in the Facet Web Part?

Oct 13, 2009 at 9:37 PM

Yes, there is. Start with advanced search and select multiple scopes there. Run the search. Faceted Search will show Scopes.


Oct 13, 2009 at 9:52 PM
Hi Leonidly,
Thnx for the quick reply!
However, it's the other way around I'm looking for. So when I search for something, the Search Facets Web Part should contain a "Scopes" column that displays the scopes that cover the current results. I can then narrow the search by applying a scope as a filter.

From: [email removed]
Sent: Tuesday, October 13, 2009 11:49 PM
To: [email removed]
Subject: Re: Faceted search and scopes [FacetedSearch:35387]

From: leonidly

Yes, there is. Start with advanced search and select multiple scopes there. Run the search. Faceted Search will show Scopes.


Oct 14, 2009 at 4:32 AM


The Faceted Search is based on managed properties extracted by the MOSS crawler. The scope is not a managed property. It is not characterics of the artifact either. Being said that, it is probably possible to customize solution to lookup the Scope for each results but I doubt that result would worth the efforts.