Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm finding that my SharePoint 2010 search results are showing results for both a folder and that folders default.aspx page. For example, my results can look like this:

products
<description taken from default.aspx page>
http://myserver/Pages/foldername

Product One - Information
<description taken from default.aspx page>
http://myserver/Pages/foldername/default.aspx

Ideally I want to remove/exclude the results for the folders, leaving just the default.aspx pages in the results.

Can anyone help me out with a crawl rule to produce the desired results? Either a 'standard' *://*... style rule or a regular expression?

share|improve this question
    
Have you tried to reindex the crawl database? –  Asha Boshle Nov 11 '11 at 2:54
    
Yes. Can you expand on why this might help? I mean, as folder not meant to show in results, or is there some other reason I might not be aware of? –  QMKevin Nov 11 '11 at 13:28
    
Kevin, can you tell me exactly where you put that code? –  user9134 Jun 28 '12 at 12:22
add comment

1 Answer

up vote 2 down vote accepted

You can limit the search returns with the query you use, and not have to change the crawl rule.

For example, If you are searching for "Product", you can enter the following into the search query box:

Product IsDocument:1

and you should only get documents and not folders.

You can configure the query web part to automatically append IsDocument:1 to all searches, so users don't need to enter it on all searches.

Update:

You enter the extra query terms in the Search Box Web Part. See screenshot. Search Box Extra Query Terms

share|improve this answer
    
I should have mentioned that this is a publishing site, used by customers and prospective customers. We can't expect them to know to use IsDocument:1 So, back to excluding them by default - crawl rules being the best way. Any ideas? –  QMKevin Nov 11 '11 at 13:26
    
you can automatically and silently append (behind the scenes) extra query terms without users knowing about them. You could add IsDocument:1 and there is probably a flag to say "is not a folder" too. –  lwbecker2 Nov 11 '11 at 13:39
    
Sorry, I just spotted that you essentially said that in your original answer (I should have my first cup of Tea BEFORE replying to posts <g>). My search results page is a copy of 'osssearchresults.aspx', so I assume the web configurations would be done on <SearchWC:CoreResultsWebPart runat="server" ShowActionLinks=false ChromeType="None"/>? I'll check around to see what I can find, unless you happen to know what I need to add and where? –  QMKevin Nov 11 '11 at 14:33
    
I found it :) I updated my ASPX webpart element to be: <SearchWC:CoreResultsWebPart runat="server" ShowActionLinks=false ChromeType="None" AppendedQuery="IsDocument:1"/> and now I get documents only. Plus I found the MS page that lists all the properties, so I have so fun times ahead trying them out :) Many thanks for the help. –  QMKevin Nov 11 '11 at 14:53
    
Thanks for the updated answer, with screenshot. I'm sure that will help others. In my case I was working with an custom application page in the /_layouts/ folder (a copy of osssearchresults.aspx), so could only edit the .aspx page directly. However, my comment above achieved the same goal as your UI based update. –  QMKevin Nov 11 '11 at 16:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.