qpixel icon indicating copy to clipboard operation
qpixel copied to clipboard

Can a search for "answers:n" limit itself to post types that can have answers?

Open cellio opened this issue 3 years ago • 1 comments

https://meta.codidact.com/posts/286454/286456#answer-286456

Searching for answers:0 returns results that are answers (because they don't have answers). That's not, strictly speaking, wrong, but it's a little confusing.

Can a search that includes the "answers" keyword restrict itself to searching post types that can have answers? Currently that's just questions, but we shouldn't bake in "is a question" because there could be other top-level post types in the future that have answers.

If the search already specifies a post type (like question) then we should use it; in a future where there's another kind of answerable post, we wouldn't want to expand the search. So I think the logic should be:

if search includes `answers:`
    then if search includes `post-type:`
        then do that
    else add "post types that can have answers" to search
else... (rest of search logic)

cellio avatar May 15 '22 20:05 cellio

If this is too hard, maybe we can include a note in the output if answers: is used, saying that all post types are included and you might want to use post-type.

cellio avatar May 15 '22 20:05 cellio