I posted this issue #1001920: Image fields in results a while ago, and i've followed the progress. It is now possible to index the image data, but i'm still not able to show the image in my results. The image fields available are ID, Size, Name, MIME type, Timestamp and URL. I tried to add the URL field and rewrite the output with <img src="[field_image:file:url]"/> but it did not help.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey’s picture

This doesn't seem to be an issue with my module, but rather with the colons in the token, which have to be fixed by Views. When I try your replacement above, I get the img tags with "url]" as the source — meaning that, for some reason, the token "[field-image:image:" is recognized instead of "[field_image:file:url]". It seems to work outside of an img tag, however …

So, please report this in the Views issue queue as a bug, there isn't really anything I can do here.

Shadlington’s picture

#1024124: Colon in tokens using Search api Solr views got closed as 'won't fix'... Will you be attempting to work around this?

drunken monkey’s picture

Oh, thanks for the note! With the issue vanishing from the "My issues" view, such things frequently elude me …
I don't think Earl is right there, but probably it's not worth arguing (or at least not worth re-opening the issue).

In any case, yes, I'll have to work around this, then. Fuck.

fago’s picture

Title: Images in search results » Fix field names to not contain colons
Category: support » bug
Priority: Normal » Major

ouch :(

fago’s picture

Title: Fix field names to not contain colons » Fix views field names to not contain colons
rgraaf’s picture

subscribe

EndEd’s picture

Subscribe

BenK’s picture

Subscribing

rgraaf’s picture

Hi Drunken Monkey,
I read in another issue comment you are very bad in estimating work, but can you give an estimation when you think you solved this issue?
Thank you!

drunken monkey’s picture

After seeing so many subscribe to this, I'm pretty sure I can do it this week.
Only thing keeping me from doing it now is that I've started to work on another hard issue (#1012878: Add a way to index an entity directly) and don't want to mix them up. As soon as a patch for that one is finished, I'll do this one.
Sorry to keep you all waiting!

drunken monkey’s picture

Status: Active » Needs review
FileSize
8.1 KB

Disregard that, the issues don't overlap anyways. Attached patch should fix the problem and include a correct update hook. Please test extensively, don't want anyone to lose their search views …

Once you apply the patch, you should not only be able to use all fields as tokens and use template overrides, but also notice that the Views UI now absolutely rocks! Yep, my work – you're welcome!

EndEd’s picture

indeed you rock! :)

rgraaf’s picture

I tried to install the patch witch Netbeans but I got a message the patch applied partially.
I have to say this is the first time I tried to patch a module in Drupal.

Did you also update the development release so I can install the module with ftp?

drunken monkey’s picture

If you haven't got the newest dev release, it's of course possible that the patch won't apply. I can hardly make a patch that will apply to all versions.
And no, this isn't in Git – first I wait what feedback comes back, whether the patch solves the problem and works as expected.

rgraaf’s picture

The patch wasn't installed correctly and now it is.
I have to agree with EndEd, you are a hero!

Shadlington’s picture

I can confirm that this works for me too, as a means of using tokens that previously contained colons.
Its not really an ideal solution for displaying images though.

drunken monkey’s picture

Status: Needs review » Fixed

Committed. Yay!

Its not really an ideal solution for displaying images though.

Since there doesn't seem to be a way to determine beforehand if a file field will contain an image, there is really rather little we can do.

Hm, or may we should just add a "Use as source URL for image" option for URL properties? I'd definitely accept this as a patch, but can't promise to add this myself. In any case, the (major) issue here is solved. I know that we kinda hijacked your issue here, but if you still see a need to improve the situation here, please create another issue as a feature request.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.