# Wrong answerCount value from discourse-solved

**URL:** https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845
**Category:** Bug
**Tags:** solved
**Created:** [February 11, 2019, 4:21pm UTC](https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845 "2019-02-11T16:21:25Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![ced](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ced/32/118318_2.png) [@ced](https://meta.discourse.org/u/ced)
#### Post date: [February 11, 2019, 4:21pm UTC](https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845/1 "2019-02-11T16:21:25Z")

</div>

The plugin set the value of the `answerCount` from Question [schema.org](http://schema.org) to the number of replies of the topic. But according to [google documentation](https://developers.google.com/search/docs/data-types/qapage#Question) the `answerCount` should be 0 is there is no `acceptedAnswer` or `suggestedAnswer` set.  
I receive complains from Google Search Console for topics without accepted answer but with some replies.

---

<div class="post-metadata">

### Author: ![SidV](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sidv/32/119460_2.png) [@SidV](https://meta.discourse.org/u/SidV)
#### Post date: [February 11, 2019, 5:01pm UTC](https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845/2 "2019-02-11T17:01:36Z")

</div>

This is new.

Maybe should use the `suggestedAnswer` with the answer that has got more “likes” 🤔 on topic when `answerCount` **is** `> 0` and doesn’t have any answer with “solved” mark. ✅

> Check Google Strutured Data for example **[here](https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fmeta.discourse.org%2Ft%2Frake-users-merge-on-former-admin-account-throws-error%2F108716)**.

* * *

I edit and explain my point.

In many debates, many situations are investigated and posed (which are answers) but do not constitute a solution to the subject in question.

Following the idea that commented @ced, a subject of 10 answers for example, some of those answers are valued with **at least three “likes”** should become “`suggestedAnswer`”.

---

<div class="post-metadata">

### Author: ![vincentp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vincentp/32/110063_2.png) [@vincentp](https://meta.discourse.org/u/vincentp)
#### Post date: [February 11, 2019, 11:23pm UTC](https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845/3 "2019-02-11T23:23:34Z")

</div>

I think I’m seeing the same issue, this just popped up on my search console today

> Either “acceptedAnswer” or “suggestedAnswer” should be specified

So far it’s only showing up 1 page with the error

[https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwww.finalbuilder.com%2Fforums%2Ft%2Fediting-jira-issues%2F6254](https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwww.finalbuilder.com%2Fforums%2Ft%2Fediting-jira-issues%2F6254)

This post has 3 answers but no accepted/suggested answer.

We updated to 2.2.1 (self hosted) yesterday so I suspect that there will be more. We imported our old forums into discourse last year, so most (probably 99%) of the posts don’t have accepted answers.

---

<div class="post-metadata">

### Author: ![Pravi](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@Pravi](https://meta.discourse.org/u/Pravi)
#### Post date: [February 12, 2019, 7:30am UTC](https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845/4 "2019-02-12T07:30:35Z")

</div>

I am also have this problem with my site. Got a mail from google webmaster!!

 ![g2](https://global.discourse-cdn.com/meta/original/3X/8/1/81c567272ed788532e3af831126eaef1da127b3f.png)

---

<div class="post-metadata">

### Author: ![ced](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ced/32/118318_2.png) [@ced](https://meta.discourse.org/u/ced)
#### Post date: [February 12, 2019, 8:27am UTC](https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845/5 "2019-02-12T08:27:21Z")

</div>

> [@SidV](#):
>
> Maybe should use the `suggestedAnswer` with the answer that has got more “likes” 🤔 on topic

I think it should only be done if there is at least one like because sometimes reply to a question is a request for more information and not an answer. And if there are no likes on any replies, the `answerCount` should still be zero.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 12, 2019, 10:39pm UTC](https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845/6 "2019-02-12T22:39:51Z")

</div>

@vinothkannans can you add investigating this issue to your list?

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [February 19, 2019, 7:14pm UTC](https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845/7 "2019-02-19T19:14:37Z")

</div>

This is fixed as per the below commit. Instead of topic reply count we should use only either 0 or 1 as `answerCount`.

[https://github.com/discourse/discourse-solved/commit/3b7baa1a513e5267d8213ceda09dd461f94cf9ad](https://github.com/discourse/discourse-solved/commit/3b7baa1a513e5267d8213ceda09dd461f94cf9ad)

> [@SidV](#):
>
> Maybe should use the `suggestedAnswer` with the answer that has got more “likes”

No, we shouldn’t do it. It could be any non-answer post.

---

<div class="post-metadata">

### Author: ![SidV](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sidv/32/119460_2.png) [@SidV](https://meta.discourse.org/u/SidV)
#### Post date: [February 19, 2019, 10:22pm UTC](https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845/8 "2019-02-19T22:22:26Z")

</div>

Great, with this fix the QApage disappear.

> - _[Check this topic](https://search.google.com/structured-data/testing-tool/u/0/#url=https%3A%2F%2Fmeta.discourse.org%2Ft%2Fwrong-answercount-value-from-discourse-solved%2F108845)_ without solved answer.
> - _[Check this one](https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fmeta.discourse.org%2Ft%2Frake-users-merge-on-former-admin-account-throws-error%2F108716)_ (solved)

Thanks!

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [February 20, 2019, 2:33am UTC](https://meta.discourse.org/t/wrong-answercount-value-from-discourse-solved/108845/9 "2019-02-20T02:33:09Z")

</div>

I hope this is correct. Until a solution is available Google not treating it as an QA Page.
