5

I was unable to figure out how to search questions answered by multiple users in the same query

For example, I want to find:

  • all php ajax questions by user:1234 and user:12345
  • all php ajax questions by either one of the user:1234 or user:12345 or user:123456

How can I do it?

1
  • I'm curious. Why would you need to search for multiple users? Aug 2, 2013 at 10:32

3 Answers 3

1

For simple queries (one user), you can use advanced search. For instance search for all posts by you which are in [tag:javascript] or [tag:jquery]. For 2+ users, you can use the query creator on data.stackexchange.com. It uses T-SQL.

For instance, this query I just threw together will look for all posts by UserA or UserB in :

select
  X.*, [User Link]
from
  (
  select 
    p.Id as [Post Link], p.OwnerUserId as [User Link]
  from
    Posts p
    JOIN PostTags pt ON pt.PostId = p.ParentId
    JOIN Tags t ON t.Id = pt.TagId
  where
    ( p.OwnerUserId = ##UserId1:string##
    OR p.OwnerUserId = ##UserId2:string## )
    AND t.TagName = 'php'

  ) As X
join Users u on u.Id = [User Link]

Edit as needed. I am not good at writing queries. I used two dummy account numbers to test by browsing the php tag:

  • 2536966
  • 2090453

Run it to see the result.

4

We could support this (there's no technical brick wall), but it's an API change on the search interface we use internally (and maybe externally). I can't see a real strong or often use case for this, same goes for the user ID operators.

That being said, we're not fundamentally against almost any idea for search. Like any change it just has to have good benefits and be worth changing. In the case of search (if it's syntax) then once it's added it's there forever, so the bar is a bit higher. Convince us it needs adding.

2
  • Let's say I am searching about something specific in jQuery but I want to look up the answers of only devs I consider champs, in this case you, or CMS or the other top answerers. Would be so convenient!
    – CuriousDev
    Aug 6, 2013 at 4:05
  • @user1089173 I don't consider my answers better than any others though, votes and the accepted check marks should be the indicators there, not usually who wrote it. I'd say only if the person has some special insight (e.g. they wrote the library) does that matter. Aug 6, 2013 at 11:01
0

I would simply search for one user's posts first, following which if I do not find relevant posts, proceed with searching the next.

If I need to use it often, I would simply bookmark the URL of the query.

You must log in to answer this question.

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