Searching for deleted topics with a keyword in title

How do I search for a deleted post that has a specific keyword in the title?

Adding ?status=deleted to the basic search URL doesn’t seem to work.

1 Like

I don’t think there is any way to do this through the Discourse search page. I can see how having a filter to search for deleted posts could be useful for site admins though.

Data Explorer queries can be used to return deleted topics and posts. Something like the query below could help:

--[params]
-- string :term

SELECT
id AS topic_id
FROM topics
WHERE deleted_at IS NOT NULL
AND title LIKE CONCAT('%', :term, '%')

For site’s on our hosting, you can also contact our support team and we’ll find the topic for you.

4 Likes

:slightly_smiling_face:

Thanks for the reply. Our mods are not familiar with Data Explorer. For now, we can do a search for all deleted posts (/latest?status=deleted) and do a page search for the word. If it’s fairly recent we’ll find it that way. Otherwise, we can ask you all for help.

Can we consider this a (low priority) request to have a deleted filter eventually added to the search pane for staff?

For moderators to use the query you’d need to add the query and then give your site’s moderators access to it. We can help you set that up through our private support if it’s something you’d like to try in the future.

For sure. There may be a technical reason for why that hasn’t already been implemented, but there have been a few times where I’ve needed to search for deleted topics and posts.

2 Likes

@sam is opposed to it as it could bloat full text index, and I tend to agree it’s not that useful of a feature.

1 Like

Hi, this works very well in general, but in the following situation it didn’t:
We happened to have the first post of a topic hidden following a flag, which means that the whole topic god hidden. Nothing weird in that, but this topic couldn’t be found with the query, although it was present in the /latest?status=deleted list. Is there a way to also find these topics with a query? (like, they’re deleted, but not really deleted :grin: )

1 Like

look at this query and modify it as needed.

1 Like