Search a single list, and don't use the OSSSearchResults.aspx page…

So, we’ve got a customer who’d hit the problem of the OSSSearchResults page that I’d mentioned before. To recap:

  • Global Searches in MOSS use a Search Center page for showing the results. These are nice, configurable, and can be made do quite a lot.
  • Contextual Searches (such as a particular list or site) use the standard WSS OSSSearchResults.aspx page. This isn’t nice and configurable, and changes will affect many sites.

Now, what would be great would be if we could have the contextual scope, but the global results page. Well, we can.For this example, I’ve got a library of ‘Travel Documents’. The documents all have an ‘Example Travel Expenses’ content type.

It struck me that I could restrict results to the scope of this list using standard SharePoint Search Scopes. I created a scope that restricted based upon the URL to the list. I called this scope ‘Travel Docs’.

Note that although the one rule here has no items matching against it, there are 8 in total, apparently. The total seems more accurate!

Now, we could go to our Site Collection settings and add the new ‘Travel Docs’ scope to the drop down list in the Search Box at the top of our pages…

… but this would apply throughout our entire site collection. We didn’t want users to be able to search this list from anywhere.

Instead, on the home page of our site containing the ‘Travel Documents’ Library we added a Search Box Web Part

When we went to configure it, though, we couldn’t set the scope. You can show the scope drop down or not, but you can’t force one. Also, although we could add extra words to the search query, we couldn’t add parameters to the search URL.

What we could do was point to a particular results page.

I created a new Search Results page, and pointed my new Search box toward it.

So, I’ve got a scope, I’ve got a search box, and I’ve got a results page. I couldn’t make the search box web part use a particular scope, but I wondered if I could make the results page. I went to it, and configured the Search Core Results web part. In amongst the settings, I found a field ‘Scope’. I typed in the name of my scope (i.e. ‘Travel Documents’).

Then I went back to my Search Box, and tried a search (for ‘Acme’):

Success! So, the scope gives us our contextual information, the results page uses that scope (rather than one being sent with the search query), and our search box takes people to that results page.

So, a query on a single list, but with a richer results page. The only down side – you have to set up a new Search Scope (although it doesn’t have to be available in the Scopes drop-down lists).

Search a single list, and don't use the OSSSearchResults.aspx page…

13 thoughts on “Search a single list, and don't use the OSSSearchResults.aspx page…

  1. Chris says:

    So close, but doesn’t work with me.

    I am doing a site collection – in it there will be sites that match our sections, obviously one will be ICT.

    On the home page of each site I want a simple box to search the docs in that site. I don’t want to go to OSSSearchResults

    This looked like a solution.

    However, unless I missed a step, the URL that gets passed to my new results page is


    (NB “Hakuna” is a text string I know is in a document at site collection level, but not in anything in any ICT librabray or list)

    Leaving off the s parameter and it all works, but I can’t seem to get that to be sent from the .

    Any ideas?



  2. Chris says:

    ..PS – getting closer – it was my scope that was at fault – I had it pointing to the root of the ICT site, rather than any folder – even so it was failing. I need to read up a bit on scope I think.



  3. Hi Andy

    just browsing your site (brought here by the breadcrumb info) and had a quick read of this article.

    maybe I misread what you said about making the search box use a particular scope I used this process for the search on my last site but found a input called appqueryterms on the search webpart with which you can something similar to scope:blahblah which should pass this value through the search box to your search results page.

    you also have to make sure that append to query is set to false.

    Keep up the good work

  4. Well, in the post this is the comments for, the scope is set by the _results_ page being used, _not_ the search box.

    In the post at we are using additional query terms (appqueryterms) – though I’m using it to pass the ‘Site’ url as a parameter to search – it isn’t a proper scope.

    I’m pretty sure you have to set Append to Query to true, but I’ve not checked.

  5. Panoone says:

    From what I understand you’d have to perform this for every list or site for which you didn’t want the dreaded OSSSearchresults.aspx page being served for results?

    I admire your perseverance but am choosing to be optimistic (in the extreme?) that this will be ‘repaired’ in a future release. 🙂

  6. Yes, it would, if you wanted that replacement for EVERY list.

    In our customers case, they had just the ONE special list.

    Another option, if you want to fix this for all lists/sites would be to write a custom HTTPModule – but it’s a much heavier weight option.

    And I share your hopes…

  7. preethi says:

    Hi ,

    We want to set the scope for a single site and not for all sites.Please help us in setting scope for single site.
    Thanks in advance

  8. Mona says:

    Good Article. How did you add the “Advance Search” link next to the regular search?


  9. Derrick says:

    I added the search drop down back. I set it to the appropriate setting. Then I made it 1 pixel wide, which basically hides. It’s still there, but no one can see it.

  10. Scott says:

    I am attempting to setup a search box with the search core results below it on a customer results page. The function works but I cannot get the results to post in the search core results box. It always opens the OSSSCResults page. So I am hoping I am just missing something simple.

  11. Absolutely awesome!! Thanks. I had the search scope down, but couldn’t figure out how to get it to be used with the Search Box. I was beginning to wonder if such an obvious requirement had been left out of what is usually a very powerful platform.

    Thanks again! Great solution.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.