In Part 2 of this series we crawled a file system and indexed that content. In doing so we also discovered that the SharePoint crawler also submits the folders of the file system to the index and Fast gladly add them. This submission of folders means that the search results can appear crowded since folders don't covey much in a standard search result.
There are a number of ways to make the folders disappear.
In a standard search result using my sample corpus:
I specifically clicked on Site --> \\vboxsvr to narrow the results to just my content and the first 55 results are folders. Bleech.
There are a number of ways to fix this:
- Write a query to tell the system to ignore folders
- Configure the Search Core Results web part to tells the system to ignore folders
- Write a custom web part to submit a query to tell the system to ignore folders
I sense a pattern. No matter how you try to do this it will always end with sending a query to Fast telling the system to ignore the folders. Freaky.
Let's fix the obnoxious folder behavior.
The first way is rather primitive and does not sit well with the average user of search. It involves understanding query syntax and Boolean logic and perhaps even advanced arithmetic. We have already used this in the last post.
In order to have the search results return only documents you add isDocument=true. The word AND is capitalized so the query uses it as an operator and not as part of the keyword.
The second way involves editing the Search Core Results web part.
- In the Fast Search Center select Site Actions --> Edit Page.
Scroll down to the Search Core Results web part and select Edit Web Part.
Scroll back to the top and upper right hand corner of the page to find the configuration for this web part.
Open Results Query Options and enter in the Append Text To Query field: isDocument=true.
- Click OK.
- Click Save and Close on the page.
- Rerun the query and see just documents returned! Good times!
- Write a custom web part: not happening here. Maybe in another post.
Thanks for Leo Souza for doing the legwork on this one.