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?
2 Answers
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.
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.
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 ...