5

I wrote a query to list all posts for a given user by user id.

SELECT id, PostTypeId, posts.Title, Body, CreationDate
FROM posts
WHERE posts.OwnerUserId = 9872

which could be found by search the following keywords

list all posts

nevertheless, I cannot find that query by more specific keywords

list all posts by user

I guess it is not convenient for those users might want to find existing queries.

I am not sure if this could be considered as feature request, please correct if necessary.

2
  • "I am not sure if this could be considered as feature request, please correct if necessary." A FR usually needs to be a bit more fleshed out and propose a possible solution. I replaced the tag with discussion. Mar 7 '20 at 12:12
  • I don't know what's to discuss. It's unexpected behaviour so maybe it should be tagged a bug?
    – ChrisW
    Mar 7 '20 at 18:14
4
+100

The Stack Exchange Data Explorer "search" is pretty naive, if not basic.

This is how your search term is used:

builder.Where(@"  qs.Title LIKE @search 
               OR qs.[Description] LIKE @search", 
        new { search = '%' + searchCriteria.SearchTerm + '%' });

So it is looking for your search text as is in either the title or the description of a query row.

Now that we know how the internal query works, we can use that to our advantage. To find your query we have to strategically add an extra percent in the search term like so:

list all posts%by user

and your query does show up:

search result with one query, the query name list all posts for a given user by user id

TL;DR

SEDE search is not a keyword search at all. It searches for the whole search term if no extra care is given. It does accept % and _ and [A-Z] to refine the search pattern. Applying those can make it into a keyword search.

You must log in to answer this question.

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