If I create a Contact then delete it it still shows up in Search

I presume there is a scheduled dB task that runs and cleans up deleted records so they do not get left in the Awesome bar Search results. But I have found lots and lots of old contacts that have been deleted weeks ago when I do a search

I’ve tested this in demo.erpnext.com and the contact is shown in search straight after being deleted which is ok. But how long should I wait before the entry is cleaned up?

That’s a neat code inspection question -

This is the Awesome search_widget code:

frappe/search.py at develop · frappe/frappe · GitHub

"
I presume there is a scheduled dB task that runs and cleans up deleted records so they do not get left in the Awesome bar Search results. But I have found lots and lots of old contacts that have been deleted weeks ago when I do a search
"

From the code my guess is the search list ‘aging’ is not time-based cleanup but fixed length stack based. For eg . the code has limit_page_length=page_length with the value 10!?

I can’t say where this query history list is persisted. Possibly one of these tables but I need to inspect these more

select * from __global_search;
select * from __UserSettings;
select * from __ListSettings;

Thanks @clarkej. Would be interesting what you find …

in logs/worker.error.log frappe.utils.global_search.sync_global_search entries like this appear at intervals

06:21:55 default: frappe.utils.background_jobs.execute_job(async=True, event=None, job_name=u’frappe.utils.global_search.sync_global_search’, kwargs={‘flags’: [{‘content’: u’Subject : RISING STARS Symposium - September 26th ||| From : info@abctech.ca’, ‘name’: ‘8ca07322d9’, ‘title’: ‘8ca07322d9’, ‘route’: None, ‘published’: 0, ‘doctype’: u’Communication’}]}, method=u’frappe.utils.global_search.sync_global_search’, site=u’aproposcomputing.com’, user=u’Administrator’) (c5dfba78-5389-4562-aad6-894bb663c4bc)

Perhaps this is an indexing or cleanup - it seems to run as both a scheduled and a asynch process!?

I’ll have to take a look at this next week

Thanks John