Is there any way, we can get the image field values from solr queries as image path with out implementing computed fields?
1 Answer
There is no way to get image path from image field from Solr indexes directly without writing custom logic.
Why?
One example would be that you have image in media library under the path
media library/images/big-images/my-banner.jpg
When you index item with an image field pointing to that media item, the path would be stored in index as /media library/images/big-images/my-banner.jpg
. But if you decide to rename big-images
folder to banners
or maybe rename my-banner
to product-banner
, indexed document for the item pointing to the image would not be updated, as the item itself is not changed, only path of media item is changed. So the path int the index would no longer be correct.
It's safe to keep the id of media item linked from an image field, but not the path.
I'm sure there are plenty other reasons why it's not there by default. But if you're ready to take the risk, nothing stops you from writing your own computed field and saving image url in Solr.