Here's my problem: I know I've posted something on Stack Overflow about a particular topic. I know how to search all my answers with a given keyword, and that feature works well. But, if I don't find anything, I assume that it must have been a comment that I posted on the subject, and I'd like to be able to find it, and the question it belongs to.

I have read:

this question, this question, and this question on Meta.

Basically, all the responses to those are about 3 years old, so it seems reasonable (to me) to ask this again ...

I've also tried just searching on Google with the keyword(s), my SO username (which I guess unfortunately is (a) not that unusual, and (b) a substring of other words, like unfortunately!), and site:stackoverflow.com, without much success.

Is there a Stack Exchange API or query that I could run to search my comments, using a keyword or keywords?

I did see one response by Jeff Atwood in one of the questions linked to above indicating that the (2009) inability to do this was annoying him, too, so hopefully I'm not the only one who's tried to do this.

  • 1
    +1 @Nate I didn't see yours when I posted mine. But I also asked for some limited retag/folder features in my question.
    – bonCodigo
    Jan 7 '13 at 14:15
  • See if the answer here helps.
    – yorkw
    Jul 19 '13 at 1:59
  • @yorkw, yes, it definitely does! Although I'd love it to be built into the stack exchange web application itself, your query seems to do what I wanted. If you'd like to post your answer again here, I will accept it as a solution. Thanks.
    – Nate
    Jul 19 '13 at 5:33

I have created a data explorer query to search a post by comment texts and userId:

SELECT Id AS [Comment Link], Score, Text 
  FROM Comments 
 WHERE UPPER(Text) LIKE UPPER('%##CommentText##%')
   AND UserId = '##UserId##'

I have also created a query to search for multiple keywords:

You can edit the query to customize it for your use.

  • 8
    Just a heads-up that, for example, if you want to search stackoverflow.com for comments, using a stack overflow user Id, you would replace meta.stackoverflow in your data explorer query URL with just stackoverflow.
    – Nate
    Apr 24 '14 at 6:16
  • Yup @Nate. You have to switch the site you want to search in. I have provided the link for Meta.SO. Apr 24 '14 at 6:22
  • is there anyway that I can filter responses I got from a user?
    – Honey
    Apr 16 '17 at 23:06
  • For anyone using these queries to search Russian: you'll need to use N-strings in LIKE-patterns, as done here: data.stackexchange.com/ru/revision/775629/960188/…
    – D-side
    Dec 28 '17 at 15:47
  • Do you know how to sort by descending date?
    – Noitidart
    May 3 '18 at 22:02
  • 2
    @Noitidart : Here you go... May 4 '18 at 5:28
  • For complete SQL newbies like me, you need to remove the #s from the search terms and your user id. :D
    – tjebo
    Jun 23 '20 at 9:05
  • Can you please explain the [Comment Link] query part, what is that syntax ([...]) meaning? Is it possible to somehow add the thread question title to this query results? Nov 10 '20 at 21:59
  • 1
    Managed to do it via SELECT Id AS [Comment Link], PostId AS [Post Link], ... yet still don't understand where that AS [Comment Link] and AS [Post Link] are come from or where they are documented. Many thanks for this excellent query, BTW. Nov 10 '20 at 22:13
  • 2
    @IvanShatsky: Those are Magic Columns specially designed for SEDE. There are few more. Nov 11 '20 at 4:01

I am adding this answer based on the discussion I had after posting a very similar question. It's truly a great feature if we can have it. I proposed the feature based on Stack Overflow inbox and comments tab.

Each time we want to find some interesting questions/answers that we encountered/interacted, currently there is only one way. Which is very tedious.

  1. Go one by one each page of the comments
  2. Go one by one each page of inbox
  3. Go one by one for each vote...

It can consume lots of time obviously.

So along the most basic keyword search on comments/responses/inbox I suggest having following bonuses as well:-

  • Let user categorize them with their own tags (limited number of tags allowed for user based on reps)

  • Add into folders (with limited numbers of folders allowed per user based on reps) like in Google inbox ...


You must log in to answer this question.

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