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.

#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


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