Problem/Motivation

#3273159: Search API token field processor was added in Search API 1.30 which is great.

But I am not sure how to make it work ... The Search API Field Token module page says:

Configuration

  1. Navigate to Administration > Extend and enable the module.
  2. Navigate to Administration > Configuration > Search and Metadata > Search API > [Search Index to edit] > Fields.
  3. Add the token fields.
  4. Click update and save.

At the step "Add the token fields.", I am not sure what to do ... Do I need to add a "Custom value (custom_value)" field?

Perhaps someone can clarify, and we can add a page under the https://www.drupal.org/project/search_api documentation.

Steps to reproduce

Proposed resolution

Remaining tasks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ressa created an issue. See original summary.

drunken monkey’s picture

Do I need to add a "Custom value (custom_value)" field?

Yes, exactly.

ressa’s picture

Issue summary: View changes
Status: Active » Needs review

Thanks for confirming. I just tried the feature, and it works really well.

After you click the "Custom value (custom_value)" button on the index page, this is the help text under the field:

Use this field to set the data to be sent to the index. You can use replacement tokens depending on the type of item being indexed.

Perhaps we can give a hint where to find the tokens, maybe by adding this sentence?

You can install the Tokens module and see available tokens under /admin/help/token

This would be quite helpful for inexperienced users.

I created a page in the documentation, and added a link under "Proposed resolution" in the Issue Summary.
Perhaps you can review it, and add it to the menu?

Feel free to add extra text about other methods to use this field (apart from using tokens) since I am not sure how that can be done.

drunken monkey’s picture

I’ve added your tutorial to the documentation, thanks!

Linking to /admin/help/token is also a good idea. However, that page is actually only available if you have both Token and Help installed. The attached patch adds a link in that case. Otherwise, do you know of any documentation page explaining the Token concept in general, as used in Core?

ressa’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! The help text with link to Token help page in your patch works perfectly, and is only shown when both Help and Token modules are installed.

There is https://www.drupal.org/documentation/modules/token and sub-pages for Drupal 7, but the differences are probably too big to use in Drupal 10, and an updated version required.

  • drunken monkey committed 8876c7ae on 8.x-1.x
    Issue #3414348 by drunken monkey, ressa: Improved the description of the...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Good to hear, thanks!
Merged. Thanks again!

Status: Fixed » Closed (fixed)

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