I was searching around for information on how I could enhance my SharePoint search results and came across this blog with some tips. The tip about opening links in new windows instead of the same window was a great idea but I couldn’t use the same tips since it was for SPS 2003. I wanted to be able to open links in new windows since I noticed a lot of users often times were searching for say PDF’s and then they would accidentally close the browser instead of hitting the back button. Big annoyance for them.
So I was snooping around the Search Core Results Web Part’s XSL Editor to see if I could edit the XSL to open links in new windows instead. It’s actually pretty easy, here are the steps:
1. Go to http://portal/searchcenter/pages/results.aspx
2. Modify Shared Web Part for the Search Core Results WebPart
3. Click on the XSL Editor Button
4. I’d suggest copying the contents of the pop up into notepad/wordpad to do your editing.
5. Search for the following lines:
<span class=”srch-Icon”>
<a href=”{$url}” id=”{concat(‘CSR_IMG_’,$id)}” title=”{$url}”>
______________________________________________
<span class=”srch-Title”>
<a href=”{$url}” id=”{concat(‘CSR_’,$id)}” title=”{$url}”>
____________________________________________________
<xsl:choose>
<xsl:when test=”$IsThisListScope = ‘True’ and contentclass[. = ‘STS_ListItem_PictureLibrary’] and picturethumbnailurl[. != ”]”>
<div style=”padding-top: 2px; padding-bottom: 2px;”>
<a href=”{$url}” id=”{concat(‘CSR_P’,$id)}” title=”{title}”>
__________________________________________
<span class=”srch-URL”>
<a href=”{$url}” id=”{concat(‘CSR_U_’,$id)}” title=”{$url}” dir=”ltr”>
____________________________________________
6. At the ends of each of the <a href= > tags, you’ll want to add on target=”_blank”
For example to make the link attached to the document icon open in a new window, the full tag would be like this:
<span class=”srch-Icon”>
<a href=”{$url}” id=”{concat(‘CSR_IMG_’,$id)}” title=”{$url}” target=”_blank”>
Using the same XSL Editor you can also manipulate how your search results are displayed and even include custom content types if you wanted to!
Good one….useful tip….I’m wondering why this didn’t strike me in the first place
This a nice article. But my requirement is, clicking on the document link in Search Result page should open documents in respective application instead of Browser Window. So that user can edit the doc and save it to document source. Just like what is happened in Document library.
Please help me.
Thanks
Hey Biswajit, did you find a solution for your problem? I’m trying to do the same, but can’t find a way.
I can’t get this to work. I’ve tried both “_target” & “_new” in all four locations.
Hi,
I tried putting in target =”_new” and it is not working, we cannot touch the 12 hive directory and need to do this setting at a XSLT level, please help
For those having difficulties – haven’t tested this but sometimes the blog styling will use fancy quotes and when you copy/paste, it doesn’t convert to the proper basic quote/unicode character. Try taking out the quotes and typing them back in manually. 🙂
I want to change CSR_IMG_ icon for folder instead of displaying IE image…
any one has tried this idea!
public void PreRender_Handler(object sender, System.EventArgs e)
{
CoreResultsWebPart coreResults = (CoreResultsWebPart)sender;
string s = “(.*?)“;
string repl=”$0$1“;
Regex ex=new Regex(s,RegexOptions.Multiline|RegexOptions.IgnoreCase|RegexOptions.RightToLeft);
string searchResultsTxt = ((Literal)(coreResults.Controls[0])).Text;
string replaced= ex.Replace(searchResultsTxt, repl);
((Literal)(coreResults.Controls[0])).Text = replaced;
}
This is the XML tag
To Dawn: It should be _blank, as in target=”_blank”
harb45 test test544343
yugygu6756 tyu hffdrtd y guyg ug
gfg5454 hghj
hjhggg6642 test test
ghhhh5432 gfhg ghfgffff
yyy8980yy ttttt rrrrr
hhhk56567 fghff gffgfgggg
jjjjj67566 fgfgf sdssess er rtd
I admit, I have not been on this webpage in a long time… however it was another joy to see It is such an important topic and ignored by so many, even
professionals. I thank you to help making people more aware of possible issues.
Great stuff as usual….
This is great for regular search results page. Do you have a solution for a search scope such as ‘This Site’ where the results are returned on the page:
http://…/_layouts/OSSSearchResults.aspx
Thanks much!
We applied the solution listed at the link below to redirect results from the OSSSearchResults page to the Search Center results page. Seems to work fine (at least until we apply an upgrade 🙂
http://sharepointsearch.com/cs/blogs/sanjaya/archive/2009/05/03/replacing-osssearchresults-aspx-with-searchcenter-pages-results-aspx.aspx
There are many landmarks in the world people climb. Have you ever climbed one and if yes, which one(s)?
This is absolutely my primary span prestigious here, in actuality unexceptional looking weblog. I discovered a karma of fascinating clobber within your blog specifically it’s discussion. From all the comments on your articles, it appears like this is truly a heart well-liked network site. Haunt on to up the fantabulous function.
Express you for another gigantic article. Where else could anyone take in that congenial of tidings in such a perfect means of writing? I arrange a presenting next week, and I am on the look an eye to such information.
Hasta Bakicisi Bebek Bakicisi Yasli Bakicisi Cocuk Bakicisi
This is altogether my preceding the time when things just here, in actuality common looking weblog. I discovered a assortment of fascinating bunkum within your blog specifically it’s discussion. From all the comments on your articles, it appears like this is without a doubt a overt well-liked network site. Defend up the telling function.
Thank you for another mammoth article. Where else could anyone win that stripe of information in such a unmitigated means of writing? I have a presenting next week, and I am on the look due to the fact that such information.
Hasta Bakicisi Bebek Bakicisi Yasli Bakicisi Cocuk Bakicisi
Thank You so much this worked well for me
BTW guys I applied these Changes on SharePoin 2010 FAST Search center. It worked just fine.
sxP3q7 http://dhY3n0fjvTtj48mG9sFnCv.com
Could you tell me the number for ? lesbian bikini porn 8607
regards mj
magic story very thanks Model Leotard Teen
dfeubn
Will I get paid for overtime? Free Nymphet Pics 8-]
Howdy! This post could not be written much better! Looking at this post reminds me of my previous roommate!
He continually kept preaching about this. I’ll forward this article to him. Pretty sure he will have a great read. Thanks for sharing!