Monday, June 06, 2011

Control the contents to be indexed/crawled

In SharePoint, one can control what contents on the page needs to be indexed, should the links on the page to be crawled or not. Use the HTML <META > tag to tell the indexer whether you want to crawl the page contents or not.  You can also direct the indexer whether you want to crawl the links on the page or not.

For example:- <META name= "robots" content= "noindex, nofollow" > tells the indexer not to crawl the contents and don't crawl the links on the page.
Similarly <META name= "robots" content= "index, nofollow" > means crawl the contents but ignore the links on the page. 
<META name= "robots" content= "noindex, follow" > means don't crawl the contents but crawl the page contents whose links are present on this page.

By default the indexer will treat as content="index,follow" if nothing is specified as above.

You can further control the specific contents on the page to be crawled or not.  This can be achieved using the "noindex" class for the <div> tag.  Any content within the <div class="noindex" >
tags will not be crawled.  This is simlar to "noindex, nofollow" i.e. no contents will be crawled within that div tag and no links will be followed.

For example:-
<div class="noindex">
Contents in this div tag will not be crawled
This link will not be crawled too
</div>


But there is an exception to this.  The
<div class="noindex">
will not work in the nested div tags. 

For example:-
<div class="noindex">
<div>

Contents of this tag will be crawled as it is inside the child tag.
This link be crawled too
</div>
</div>

Labels: ,

Thursday, May 26, 2011

People Search and Bets Bets web part

Search Best Bets web part works only when it is added on the content search results page(results.aspx). This web part doesn't work when it is added on the people search results page(peopleresults.aspx). There are few other web parts whose behaviour changes based on which page layout it is added to in the search center.

Search Action Links web part is one of them. When it is added on the content search results page the sort options are different compared to when it is added on people search results page. On content search results page it give sort by Relevance and Modified date. Where as when it is on the people search results page it shows the sort by Default, Name and Social Distance.

Another major difference in web part's behaviour is of Refinement Panel web part (SharePoint 2010). Even if you add the People Refinement Panel web part on the content search results page, it behaves as normal refinement panel web part. This is same even after changing the Filter Category Definition of the web part.

Labels: ,

Monday, October 26, 2009

Image distortion on MOSS People Search page

Recently I came across this issue where the images on the people search results page get distorted.   Image was getting strecthed vertically and only part of the image was displayed horizantally.  Images were not getting resized to 75*75 px as designed.

On analyzing, found that People Search Core Results web part is designed to display the people's my profile image in 75*75 px size.  The web part contains the javascript function resizeProfileImage('img_id') which resizes the image.  This javascript is set to trigger in 1 ms once the profile image is displayed.  When there is large images this function will get triggerred before the image is loaded and hence causing the distortion. 

To overcome this issue, I increased the trigger time of the above function to 2 sec i.e. window.setTimeout("resizeProfileImage('img_id')", 2000) .  With this change issue didn't occurred again.  However later I added the Faceted Search web part on the page, which was taking some time to compile the facets and due to this image distortion issue appearred again.  This time I used different approach and added the below javascript to the page using a content editor web part and this resolved the image distortion issue permenenetly.
----------------------

<script>
function fnResizeNew()
{
var fields,i;
fields = document.getElementsByTagName('IMG');
for( i = 0; i < fields.length; i ++ )
{
var imgid = fields[i].getAttribute('id');
if(imgid.indexOf("CSR_IMG_") != -1)
{
resizeProfileImage(imgid);
}
}
}

_spBodyOnLoadFunctionNames.push("fnResizeNew");


</script>
------------------

Labels: