This is for verision 6 of Drupal. I have a taxonomy category with 11 results, but only the top 10 are showing up. I am getting my results by $result = taxonomy_select_nodes(array($tid), 'or', 0, FALSE, 'n.title asc'); Looked into the code for the select http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module/function... and based on my parameters came up with the following query $result = db_query("select distinct(n.nid), n.sticky, n.title, n.created from node n inner join term_node tn on n.vid=tn.vid where tn.tid = %d and n.status = 1 order by n.title asc",$tid); which returns all 11 results. I went into /admin/content/node-settings and upped the value from 10 to 30, but there was no change. Then I changed the FALSE to TRUE in the original code and all 11 results showed up. Not sure why the result set was limited when paging was turned OFF. Can anyone shed light on what was happening there? Thanks, Bob
On the API page, notice the effect of $pager -- it calls pager_query() with 10 as the limit. You might consider using Views http://drupal.org/project/views for doing this sort of thing. On Wed, Jan 26, 2011 at 10:13 AM, bob brazeau <bobbrazeau@gmail.com> wrote:
This is for verision 6 of Drupal. I have a taxonomy category with 11 results, but only the top 10 are showing up. I am getting my results by $result = taxonomy_select_nodes(array($tid), 'or', 0, FALSE, 'n.title asc');
Looked into the code for the select
http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module/function...
and based on my parameters came up with the following query $result = db_query("select distinct(n.nid), n.sticky, n.title, n.created from node n inner join term_node tn on n.vid=tn.vid where tn.tid = %d and n.status = 1 order by n.title asc",$tid);
which returns all 11 results.
I went into /admin/content/node-settings and upped the value from 10 to 30, but there was no change.
Then I changed the FALSE to TRUE in the original code and all 11 results showed up. Not sure why the result set was limited when paging was turned OFF. Can anyone shed light on what was happening there?
Thanks,
Bob
Are you referring to the following chunk of code? if ($pager) { $result = pager_query($sql, variable_get('default_nodes_main', 10), 0, $sql_count, $args); } else { $result = db_query_range($sql, $args, 0, variable_get('feed_default_items', 10)); } I saw that, but it seems to behave counter intuitively to me. When I set the pager parameter to FALSE it limited my results to 10. When I set pager to TRUE then it respects the pager limit (now 30). I guess when I set the parameter to false I assumed there wouldn't be a built-in limit, or at least there would be a straight forward way to override it. Unless I am mistaking how the function works. Bob On Wed, Jan 26, 2011 at 11:11 AM, Carl Wiedemann <carl.wiedemann@gmail.com> wrote:
On the API page, notice the effect of $pager -- it calls pager_query() with 10 as the limit. You might consider using Views http://drupal.org/project/views for doing this sort of thing.
On Wed, Jan 26, 2011 at 10:13 AM, bob brazeau <bobbrazeau@gmail.com> wrote:
This is for verision 6 of Drupal. I have a taxonomy category with 11 results, but only the top 10 are showing up. I am getting my results by $result = taxonomy_select_nodes(array($tid), 'or', 0, FALSE, 'n.title asc');
Looked into the code for the select
http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module/function...
and based on my parameters came up with the following query $result = db_query("select distinct(n.nid), n.sticky, n.title, n.created from node n inner join term_node tn on n.vid=tn.vid where tn.tid = %d and n.status = 1 order by n.title asc",$tid);
which returns all 11 results.
I went into /admin/content/node-settings and upped the value from 10 to 30, but there was no change.
Then I changed the FALSE to TRUE in the original code and all 11 results showed up. Not sure why the result set was limited when paging was turned OFF. Can anyone shed light on what was happening there?
Thanks,
Bob
On 1/26/2011 10:23 AM, bob brazeau wrote:
$result = db_query_range($sql, $args, 0, variable_get('feed_default_items', 10));
This function will fetch 10 items or the number of items specified in the variable only. It will not fetch all items. This is more or less a safety mechanism. If you have 1 million items in your database, this would crush your site every time it is visited.
Ah, fair enough, good way to ensure sites don't gradually slow down as they grow. Looks like D7 includes a variable to specify a different limit so thats pretty cool too. Thanks for pointing the hard coded limit out Bob On Wed, Jan 26, 2011 at 11:35 AM, Earl Miles <merlin@logrus.com> wrote:
On 1/26/2011 10:23 AM, bob brazeau wrote:
$result = db_query_range($sql, $args, 0, variable_get('feed_default_items', 10));
This function will fetch 10 items or the number of items specified in the variable only. It will not fetch all items. This is more or less a safety mechanism. If you have 1 million items in your database, this would crush your site every time it is visited.
participants (3)
-
bob brazeau -
Carl Wiedemann -
Earl Miles