Some feedback please on my hook_search_execute function? I'm following along with Pro Drupal 7 Development by Apress (page 321) and using it as a guide to create a module that searches a legacy database of pages I've yet to import into a drupal install. I'm also using the API as a guide as well.

Everything works except for the number of results returned by dynamic query.  What happens is, despite having PagerDefault and using a limit of 10, only 1 item shows up on the page. I can switch the number to any number and it's still 1.

I know for a fact there are 240 items that should be returned. And, indeed my pager list 24 pages (24 pages of 10 results). Again, however, there is only 1 result per page for a total of 24 results.

Here is my function:

function searchharvest_search_execute($keys = NULL) {

    // Set up and execute the query
    $query = db_select('search_index', 'i')-&gt;extend('SearchQuery')-&gt;extend('PagerDefault');


    $query-&gt;join('url_data', 'ud', 'ud.id = i.sid');
    $query-&gt;searchExpression($keys, 'searchharvest');

    //If there weren't any results return a blank result set
    if(!$query-&gt;executeFirstPass()){
        return array();
    }

    //If the first pass returned at least 1 record execute the search
    $found = $query-&gt;limit(10)-&gt;execute();

    //dsm($query);
    print_r($query-&gt;__toString());
    //Create the search results output
    foreach($found as $item){
        //dsm($item);
        //get found items from db
        $note = db_query("SELECT url, stripped_html from url_data where id = :sid", 
                array(':sid' =&gt; $item-&gt;sid))-&gt;fetchObject();




        $results[] = array(
            'link' =&gt; $note-&gt;url,
            'type' =&gt; t('searchharvest'),
            'title' =&gt; 'my title ' .$item-&gt;calculated_score, 
            'score' =&gt; $item-&gt;calculated_score,
            'snippet' =&gt; search_excerpt($keys, $note-&gt;stripped_html),
        );

        return $results;
    }


Thoughts on where the error is? Here is a photo as well with the query 'print_r' 'ed at the top
The return $results was inside the foreach loop, which stopped the iteration, hence only 1 result.