One common thing people have asked for in the MSDN Search Forums a lot (besides the obvious things like wildcard search) is the ability to get results that contain just documents. In this case, people just want documents, no list items or folders, or sites, or anything like that. It wasn’t terribly difficult to do in MOSS 2007 and I even wrote a post about it, but now there is another way this can be done. We’ll be looking at the CRWP in more detail pretty soon, but I thought this would be something quick to mention. Consider the following search results.
From the screenshot above you should see that I have documents and list items returned in my search results. We want to filter that down to just documents. Before we had to create a scope to handle it. Now we can use the new Append Text to Query property. Take a look.
This new textbox allows you to append whatever you want to what the user searched for. In my case I am adding IsDocument:”1” to the query to restrict our search to documents, but you could add whatever you can think of to your query here. After adding it, here is what my search results look like.
My results only contain documents now. This may just be an issue with Beta 2, but it causes the record count to be incorrect and the pager to think there are additional pages. Anyhow, I think this property will be quite useful. This functionality was actually already sort of present in MOSS 2007. There is an undocumented query string parameter, a, that does this same functionality. I stumbled upon it once when I was using reflector on the CRWP.