Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Neil Tootell 73 posts 118 karma points
    May 07, 2010 @ 13:33
    Neil Tootell
    0

    Umbraco Examine and paging

    Hi all,

    I'm implementing an examine search system on umbraco 4.0.3 and so far it's really great. I have a fast and stable front end search system for a 3.5k node site.

    Where I'm stuck is implementing paging. I can see that the "Skip" method is supposed to skip to a point in the search results, but it's just not working.

    Lets say I have the following...

     

                var searchResults = ExamineManager.Instance.SearchProviderCollection["SiteIndex"].Search(queryText, 100, true);

                _totalResults = searchResults.TotalItemCount;

    Then I would presume the Skip method should limit the results like this...

    searchResults.Skip(15);

    But although it compiles correctly, it makes no difference to the results set that is returned. Am I missing something fundamental here?

    In the old umbSearch system I would have done this...

    for (int i = pageStart; i < pageEnd; i++)

                {

                        Document doc = hits.Doc(i);

    etc...

     

    Any ideas?

    Thanks

     

     

    Neil

  • Aaron Powell 1708 posts 3046 karma points c-trib
    May 09, 2010 @ 01:26
    Aaron Powell
    0

    Which version of Examine are you using? The current builds in the repository works fine with the Skip method (we've got a unit test which ensures it).

    If you inspect the results in the debugger do the results appear to be duplicates?

  • Neil Tootell 73 posts 118 karma points
    May 10, 2010 @ 15:31
    Neil Tootell
    0

    Hi,

    We're using version 50650 from source. I've created a work-around for the solution by setting up a counter and increasing it for each result as they're listed out. It works very well. It only adds the result to the screen if it's result number falls inside a range of numbers for that particular page.

    The results in debugger don't show duplicates. TotalItemCount remains the same regardless of what I apply with Step.

    Do you have an example of it running?

    I've also made a simple snap-in panel for the Developer section of umbraco for testing the Examine system. You're welcome to a copy when I've polished it. I'm also trying to extend Examine with PDFBox to enable PDF indexing - wish me luck :)

    n

  • Aaron Powell 1708 posts 3046 karma points c-trib
    May 10, 2010 @ 16:07
    Aaron Powell
    0

    This file has a unit test for paging:http://examine.codeplex.com/SourceControl/changeset/view/51946#1078835

    Also, we're working on adding PDF indexing OOTB, target is codegarden 10 release for that.

  • Neil Tootell 73 posts 118 karma points
    May 10, 2010 @ 16:24
    Neil Tootell
    0

    Thanks Slace - I'll check it out. n

  • Jeff Grine 149 posts 189 karma points
    Jul 15, 2010 @ 22:31
    Jeff Grine
    0

    This one took me a while to figure out how to use for paging. Finally found this example from Slace's dddMelbourne demo in case anyone else is struggling with it:

    this.View.Model.SearchResults = results.Skip(pageNumber).Take(5); 

    Have a feeling Neil was running Skip without assigning the return value - that's what got me anyway. 

  • overflew 87 posts 110 karma points
    Jul 26, 2010 @ 13:07
    overflew
    0

    Note on the above - You may wish to multiply pageNumber by 'results per page'.

Please Sign in or register to post replies

Write your reply to:

Draft