Display image_url in the json search results

I want to display image_url in the json results I return when searching for the topic.

Is it available in the query form, I see it now returns False in the source code

/search.json?q=loreal&image_url=true

You can check demo online here: Máy hàn mini an toàn, giá tốt, mua ở đâu? - Nhà cửa & Đời sống - Thư viện mua sắm (Sorry for the language, it’s at the end of the post)

1 Like

https://github.com/discourse/discourse/blob/10a6824e5f49a69c43bf6cb3f09de0a1c57bb0d4/app/serializers/search_topic_list_item_serializer.rb

Is it blocked here

1 Like

Hey @Bcat

Did you see this?

1 Like

With queries json category, tag, top, newest all include image_url
But with search, no include image_url

Currently I am querying 1 json for a list (10 topic)
Then there are 10 queries to get the image.
In total, it took 11 queries to the server.

1 Like

I’m not 100% sure this is the same problem, but I think it could be. I’m using the search api, the image_url no longer seems to show up in the topics array using this query. The object in the topics array links here where there is an image in the top post, but unless I’m misunderstanding something in the API docs (which I might be) the image_url is missing. It’s been a while since I’ve looked at this, but I thought this used to work as-is.

Yes it is no longer there.

If you need an external solution interfering with the discourse, I can suggest you.