Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

How to search 'This Folder' and subfolders

  Asked By: Jackson    Date: Nov 03    Category: Sharepoint    Views: 4697

A number of people have asked how to make the Search webpart in the document library search through subfolders when the 'This Folder' scope is set. I've not seen a real answer before.

1. In the document library goto Content and choose the Search part.

2. Open up advanced settings.

3. In the code look for :- strScopeQuery = " ( """ & g_strParentNamePropName & """ = '" & strScopeQuery & "' ) AND "

it's about 1/3 of the way through the code.

4. Change it to :-

strScopeQuery = " ( """ & g_strParentNamePropName & """ LIKE '" & strScopeQuery & "%' ) AND "

5. Save.



1 Answer Found

Answer #1    Answered By: Meaghan Webster     Answered On: Nov 03

I have a follow-on question:

How do I make a specific content  source scope  the default on the search  web
part(s) instead of "this site"?

Here's our situation:

We have tons of documents on an old fileshare that represents the "old way
of doing things". All of the content out there is unstructured and chaotic.
On SPPS, this old fileshare (call it OLDSTUFF) is indexed regularly since
it's still the primary means of storing documents until we get everyone

The workspace content source is named with a scope of "NEWSTUFF". Then for
roundness let's also say I have 3 other content sources: "Public Folders",
"www", and "Docs" .

By default, the search dropdown has "This site" selected. That
auto-searches all the content sources. This poses a problem because we
don't want the OLDSTUFF to come up in normal searches -- we want users to
have to select OLDSTUFF from the dropdown to search it. We'd rather
NEWSTUFF be the default content source scope selected on the dropdown so
that only *it* (the document  library, dashboards, basically) is searched
unless they manually select something else.

Looking at the search part  code yields:
strScopeOptions = Replace(strScopeOptions, "<OPTION value=""" &
g_strSearchScopeThisSite & """>", "<OPTION value=""" &
g_strSearchScopeThisSite & """ selected>")

So I guess I change  the g_str_SearchScopeThisSite with either a hard-coded
value (frowned upon) or some other type of variable so that my content
source gets the "selected" keyword on the OPTION tag.

Am I on the right track? Any suggestions for staying away from the
hard-coded value? Somebody got a quick way to check the Scope value of the
content source named the same as the workspace? That part is beyond my
reach at this point.

Didn't find what you were looking for? Find more on How to search 'This Folder' and subfolders Or get search suggestion and latest updates.