Issue
I have a Drupal 7 site and I'm struggling to find a solution to the following problem.
I have all my cron tasks are running fine but the search indexing cron. It produces this error in the logs and stops from indexing. It looks like it has something to do with the entity_extract_ids()
function in field.multilingual.inc, but I have no clue where to start on this. Here is the error log:
exception 'EntityMalformedException' with message 'Missing bundle property on entity of type node.' in /home/xxxxx/public_html/includes/common.inc:7562
Stack trace:
#0 /home/xxxxx/public_html/modules/field/field.multilingual.inc(268): entity_extract_ids('node', Object(stdClass))
#1 /home/xxxxx/public_html/modules/field/field.attach.inc(1111): field_language('node', Object(stdClass), NULL, 'en')
#2 /home/xxxxx/public_html/modules/node/node.module(1358): field_attach_prepare_view('node', Array, 'search_index', 'en')
#3 /home/xxxxx/public_html/modules/node/node.module(1284): node_build_content(false, 'search_index', 'en')
#4 /home/xxxxx/public_html/modules/node/node.module(2668): node_view(false, 'search_index')
#5 /home/xxxxx/public_html/modules/node/node.module(2650): _node_index_node(Object(stdClass))
#6 [internal function]: node_update_index()
#7 /home/xxxxx/public_html/includes/module.inc(826): call_user_func_array('node_update_ind...', Array)
#8 /home/xxxxx/public_html/modules/search/search.module(363): module_invoke('node', 'update_index')
#9 [internal function]: search_cron()
#10 /home/xxxxx/public_html/sites/all/modules/ultimate_cron/ultimate_cron.module(726): call_user_func('search_cron')
#11 [internal function]: _ultimate_cron_run_hook('search_cron', Array)
#12 /home/xxxxx/public_html/sites/all/modules/background_process/background_process.module(428): call_user_func_array('_ultimate_cron_...', Array)
#13 [internal function]: background_process_service_start('ultimate_cron%3...')
#14 /home/xxxxx/public_html/includes/menu.inc(516): call_user_func_array('background_proc...', Array) #15 /home/xxxxx/public_html/index.php(21): menu_execute_active_handler()
#16 {main}
Any help or insight would be greatly appreciated.
Solution
I'll tell you how I fixed it.
I got EntityMalformedException: Missing bundle property on entity of type node error in my watchlog (recent log messages) after trying to index search (so after cron run). Before my index was let's say 48%, after cron run it stayed same.
I did lots of things, other suggestions didn't help me, but finally I did this and suggest you too:
- Backup your database!!!
- Go to phpMyAdmin, to "run sql" section.
- Put here "SELECT n.nid FROM node n LEFT JOIN search_dataset d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC LIMIT 0,1"
if you have table prefix, don't forget to put it here. - As result you'll get one row with nid, pick it mind.
- go to node table and run here "SELECT * FROM node WHERE nid=your-nid" where your-nid is nid from step 3
- Try to open your-website/node/your-nid - for me I got "404 error"
- Go back to phpMyAdmin and delete this row
- Run cron again
AS for me I did this 7-8 times to delete all "bad" nodes from database and finally get 100% index
if you don't have access to phpMyAdmin I guess you can do this:
Turn on PHP filter module and backup database create node type of page for example, to body add code
<?php
$result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid ASC", 0, 1);
echo $result;
?>
choose "PHP Filter" of course
Click "Preview" You should see node id on the screen. Test it like in step 6 of directions for phpMyAdmin and pick in mind Now you can delete it with adding to the body
<?php
$nid = "your-nid";
db_delete('node')
->condition('nid', $nid)
->execute();
?>
Click Preview again Run Cron again
Code above I didn't test, so if you'll use it please post here if it works
Thank you and happy indexing ;)
Answered By - Paradoxetion