1

Is there a way to search for a Stack Overflow post that I closed and that has a certain keyword say "this" or certain code say this in it?

I mean, I want to search by typing in the search bar something like:

user:783380 is:question          "this"
                         ^^^^^^^---------->what should come in this blank space

In the above query I have left some space indicating what should come there something like votes:closed or votes:deleted.

Is this doable? I want to search for a post that I, say, closed or deleted and that contains a specific keyword.

1 Answer 1

3

You can't use the on-site search to find posts that you closed.

You can find posts that are closed by using the closed:1 search option. You can find your posts by using the user:me search option.
When you combine those you get questions that you wrote and are now closed.

For your specific search requirement we have to turn to the Data Explorer.

The PostHistory table holds in rows with typeid 10 close events and then record the close voters as a JSON blob in the Text column.
In SQL Server we can use OPENJSON to query over that blob. Combining all that in a query gives us this:

select p.id as [Post Link] 
     , p.creationdate
     , p.score
     , p.owneruserid as [User Link]
from posthistory ph
inner join posts p on p.id = ph.postid
cross apply openjson(ph.text,'$.Voters') with (userid int '$.Id') as voters 
where ph.posthistorytypeid = 10 -- closed
and voters.userid = ##userid:int?811##
and p.body like concat('%', ##search:string##, '%')

When run today for a well known close voter we get this result:

result for userid 811 and term "this" showing around 600 question titles

Keep in mind SEDE is updated once a week on Sunday.
Never forget that Monica Cellio created the awesome SEDE Tutorial.
Say "Hi" in SEDE chat.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .