Problem/Motivation
Provides a Search API token field processor
Use case - https://www.morpht.com/blog/announcing-search-api-field-token-module
Contrib module - https://www.drupal.org/project/search_api_field_token
This will also solve #2962569: Index image style URLs
Steps to reproduce
Proposed resolution
Remaining tasks
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | interdiff-3273159-25-27.txt | 649 bytes | naveenvalecha |
| #27 | 3273159-27.patch | 11.1 KB | naveenvalecha |
| #25 | 3273159-25--custom_value_processor.patch | 11.14 KB | drunken monkey |
Issue fork search_api-3273159
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
naveenvalechaComment #4
drunken monkeyThanks for suggesting this new feature!
However, there is a lot missing before I can commit this:
Comment #5
naveenvalechaComment #6
naveenvalechaComment #7
naveenvalechaThis will also solve #2962569: Index image style URLs
Comment #8
naveenvalechaComment #9
naveenvalechaUpdated issue summary + Added tests.
Comment #11
naveenvalechaComment #12
naveenvalechaComment #14
naveenvalechaIt was a random failure. I re-tested it. Ready for review.
Comment #15
drunken monkeyThanks for adding the tests!
As mentioned, however, I’ll wait until more people express support for this before working further on this.
Comment #16
naveenvalechaThanks for the update
I have tweeted about it https://twitter.com/naveenvalecha_/status/1646193183523753990.
Also slacked for the feedback in https://drupal.slack.com/archives/C3E9QDZ5M/p1681318102649399
Comment #17
starfighter1 commentedI'd like to see this feature. When using search API via headless Drupal, we can only get the URL to a media field with the normal image right now. This is useful for a search teaser image.
There's no clear way to get a URL for an image style from search results data which would be useful for a headless frontend so we don't have to fetch the large uncompressed image.
Comment #18
4alldigital commentedI would also be interested in this feature. Having image-styles out of the box would be very useful for all headless app using Drupal as a CMS. This wold negate the usage and integration of additional 3rd party image generation services. I've been using the media style patch for a few years now for this feature.
Thanks for all the work.
Comment #19
naveenvalechaThanks for your feedback, @starfighter1 and @4alldigital
Would you care to RTBC if this works for you
Comment #20
4alldigital commented@naveenvalecha I am not sure what the process it or requirements to "review" and "test", but if you can let me know on here I'll see if I can help. thanks.
Comment #21
naveenvalecha@4alldigital
Thanks for your prompt response.
Here's the page which explains how the issue is marked "Reviewed & Tested by community" https://www.drupal.org/docs/develop/issues/fields-and-other-parts-of-an-...
Comment #22
eleonelWorking fine for me, looking good.
Comment #23
drunken monkeyOK, especially when put together with #2962569: Index image style URLs it does seem like there is enough interest for this to go forward.
Attached is a suggested revision, where I more clearly describe the processor and field. In effect, it’s a processor/field that lets users index custom values, potentially containing tokens. However, I don’t think the previous description really made that clear enough to users not familiar with this ticket.
Still, I expect some confusion amongst users who just spot this field in the “Add fields” dialog, so any suggestions how to make the functionality clearer are welcome.
Finally, I amended the processor and expanded the tests to make sure this also works properly when multiple different types are indexed in the same index.
Please test/review!
Comment #25
drunken monkeyComment #27
naveenvalechaThis will fix the tests.
Re: #23
Thanks for all the great work. The changes look good to me.
Nitpick: custom_value is a generic name. The custom value represents any string value that could be accepted, but we only allow tokenized text. I don't have any strong opinion on the naming, but we should use something like "token_value" or "tokenized_text" or something like that. This is not a blocker for it.
Comment #28
drunken monkeyThanks for the test fix!
That was exactly my point: we don’t only allow tokenized text, entering a text with tokens in it (for whatever reason) would be completely fine as well.
If we later add options to specify different values per datasource or bundle, this could even become pretty useful completely without tokens.
Anyways, I’m open for other suggestions, but I don’t think we should focus on the tokens this much. First priority is to give users, especially inexperienced ones, a clear idea of what the field will do.
Does anyone else have an opinion on this?
Comment #29
naveenvalecha@drunken monkey
Completely satisfied with your thoughts on #28
This looks me ready to be in :)
Comment #30
eleonel#27 looks good
Thank you
Comment #31
drunken monkeyGood to hear. Merged.
Thanks again, everyone!