When _node_reference_options() does execute node_reference_potential_references(), it doesn't pass in any options, wich means that the defaults are used.

The default set limit to 0, which means no limitation at all.

If you have ~400k nodes, like we do, then it explodes.

The attached patch sets the default limit to 10 instead, not sure if a different value should be chosen, but there needs to be something.

#7 After.png25.18 KBRenatoG
#7 Before.png36.52 KBRenatoG
#5 references-1345920-5.patch1.55 KBjenlampton
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es). View
#3 1345920.patch642 bytesgrendzy
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es). View
node_reference_missing_default_limit.patch450 bytesBerdir
PASSED: [[SimpleTest]]: [MySQL] 14 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Berdir’s picture

Status: Active » Needs review
Berdir’s picture

Status: Needs review » Needs work

The patch needs more work, the current logic limits select fields to 10 entries as they don't pass a limit option explicitly.

grendzy’s picture

Priority: Normal » Critical
Status: Needs work » Needs review
642 bytes
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es). View

I think this is critical, since it causes fatal out of memory errors.

For me, the solution was to remove the code that modifies display_options['pager']['options']['items_per_page']. What was happening is the default (0) was clobbering any value set in the view itself. This also fixes #1330494: Node Reference field doesn't recognize "Items to display:Display a specified number of items".

Am I missing something? Is there a condition where items_per_page needs to be set by the module?

wuinfo’s picture

I think we need some kind of special widget to meet the requirement or just use the auto complete text field. #3's patch limited the available options and did not solve the problem of referencing by node type.

jenlampton’s picture

Title: _node_reference_options() does not limit the number of results » Add a limit to the number of results in _node_reference_options().
Issue summary: View changes
1.55 KB
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es). View

This patch combined the two approaches above, but adds a limit for user references as well as node references. I also thought 10 was too few items, so changed the initial default to 25.

igormoreira’s picture

Thanks a lot... i spent so much time trying to understand why my views number of items doesnt work at all

RenatoG’s picture

Assigned: Unassigned » RenatoG
Status: Needs review » Reviewed & tested by the community
Issue tags: +ciandt-contrib
36.52 KB
25.18 KB

Hi people.

I applied the patch and works good for me.



Thank you very much.

  • RenatoG committed 909407d on 7.x-2.x authored by jenlampton
    Issue #1345920 by jenlampton, grendzy, RenatoG, wuinfo, igormoreira: Add...
RenatoG’s picture

Status: Reviewed & tested by the community » Fixed


Commited in dev branch.

Thank you very much for contribution people.

Good Work.


Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.