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

is there an option how to limit the number of results returned? F.e. I have a req where client want to show only 50 of tasks.

Thanks

share|improve this question
add comment

3 Answers

So I ended up with restricting number of results in xslt. I created c# xslt extension function which is responsible for creating navigation with the same structure as oob navigation. In this navigation I restrict render the 'Next' links that can lead user to next page with another results. To user it look like the search reached end but anyway there are still results. I will post my code later because I have to clean naming.

share|improve this answer
add comment

You can set the List View Threshold on the View definition. In your list just head over to "Modify View" and set how many items you would like to be displayed.

share|improve this answer
    
hi, on core results web part? –  Ivan Feb 18 '13 at 19:34
    
With Core Results you mean the search? Or a List View WebPart? –  Dennis G Feb 18 '13 at 20:00
    
yes, search :) sorry if i do not express the problem enough –  Ivan Feb 19 '13 at 6:59
    
You can either set it in the WebPart properties of the Core Result WebPart or you can change the "<xsl:param name="MaximumRows"> in the underlying XSLT to whatever you want. –  Dennis G Feb 19 '13 at 7:34
    
probably i do not express the problem again enough, sorry for that. The xslt does not have the param MaximumRows either the web part. I need to change the total rows/results returned (eg show only top 50), not just the number of results per page. Also i need to preserve pagination. –  Ivan Feb 19 '13 at 7:40
add comment

In your CoreResultsWebPart, you can override the ConfigureDataSourceProperties method like this:

protected override void ConfigureDataSourceProperties()
{
    base.ConfigureDataSourceProperties();

    CoreResultsDatasource dataSource = this.DataSource as CoreResultsDatasource;

    // setting the value to 50 as per your example.
    dataSource.ResultsPerPage = 50;
}
share|improve this answer
    
thanks for response : ) however i needed to override all the result returned, for example from 1000 results show only top 50 on 5 pages with paging 10 –  Ivan Feb 20 '13 at 16:17
    
Ah -> slightly different than your question. No worries, you could look at the HighestResultPage property of the CoreResultsWebPart, but I've never specified a value for that property & I'm not sure if that would work for you. –  Jason Rastovski Feb 20 '13 at 16:36
    
well i first tried it but the behavior was not as expected. it shows you next page link but when you visit it, the ugly message pops up that you are trying to visit more than is allowed :) –  Ivan Feb 20 '13 at 18:21
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.