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.

#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 ]


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
new642 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.