9

If I search for closed:yes is:answer, I got the same number of results as searching for closed:yes. Is there any way to search for answers on closed questions? Am I not using the correct syntax for searching?

3
  • 1
    Not sure what exactly you are trying to search for, but doesn't closed:yes answers:1 get you what you want?
    – yivi
    Commented Mar 2, 2021 at 9:11
  • What @yivi said would be my suggestion as well but if you add additional search terms you would still be searching in questions only.
    – rene
    Commented Mar 2, 2021 at 9:14
  • How I think it works: Questions and Answers are just Posts. Closed:yes would translate into where closeddate is not null. Answers don't have their closeddate set when the question gets closed. You end up with just questions. An implementation quirk seems to be that once you selected questions it refuses to take into account answers. I guess that is how Elastic wants it ...
    – rene
    Commented Mar 2, 2021 at 9:19

2 Answers 2

16

Your search indeed will never return useful results, because you told the search engine you only want to search for answers by setting is:answer. But answers can't be closed (only questions can), so there are no answers with closed:yes. So instead, the is:answer operator is ignored, as if the search used is:question instead.

That's because closed:... is only useful for question searches. You can find closed questions with at least one answer instead, by combining closed:yes with the answers:... operator, which accepts a range; answers:1... would find questions with 1 or more answers that are closed:

closed:yes answers:1... finds more than 750k closed questions with answers.

answers:1 is equivalent to answers:1...; if you wanted to find closed questions with exactly one answer, use answers:1...1:

closed:yes answers:1...1 results in a little over 418k closed questions with a single answer.

You could combine either with the isanswered:yes and / or hasaccepted:yes operators; these limit question results to posts with at least one upvoted answer and questions with an answer that has been marked as accepted, respectively.

You can't otherwise search for the content of answers that were posted on a closed question.

1
  • For content search SEDE is an option but you have to restrict the search scope to a tag.
    – rene
    Commented Mar 2, 2021 at 11:26
1

A similar question turned up recently on cross validated meta here, and it linked to this question here.

There is a comment by rene, that mentions a SEDE search, but I thought it might be nice to also have it in an answer. The following two scripts allow you to search for answers on closed questions of specific users: this and this.


The search prompt on the main websites is not gonna be able to process a search like that. The searches of this type use an inner join of two selections of the data tables. The search prompt is only able to process a search of the type 'select stuff from some table where some conditions apply'. This is a search for rows in a table where the 'some conditions' only apply to each specific row (like in an Excel spreadsheet you filter rows based on contents in the cells). With an inner join operation the rows are augmented with additional information about connections from rows in other selections or tables.

You must log in to answer this question.

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