0

I want to load relationships from the node_load(). So for example getting the article content type and loading the author information with the same query. How would I go about doing this?

The end goal is to make a computed field for Drupal Search API so that I can convert the field's name. The relationship fields are currently in the form table_name:field_name but I am indexing into Algolia and therefore need the field name to just be field_name.

  • I have not understand what is your end goal. Do you want to index multiple fields as fulltext? – milkovsky Aug 2 '19 at 9:05
  • @milkovsky My end goal is to add fields to a search index. So I need to have relationships within that search index. But the search index (Algolia) breaks when there are colons in the field name that is sent across. So I need to remove them – Peter Ayello Wright Aug 6 '19 at 15:06
  • You can just index the rendered html – milkovsky Aug 6 '19 at 19:01
  • Could you explain what you mean by that? Is that something that is possible to do in Drupal 7? – Peter Ayello Wright Aug 7 '19 at 9:44
  • see my answer below. – milkovsky Aug 8 '19 at 11:00
0

As an option you can index the entire rendered HTML of your content. Let's assume your index is called "default_node_index" and content type is "article".

  1. Visit /admin/config/search/search_api/index/default_node_index/workflow
  2. Enable "Complete entity view" enter image description here
  3. Visit /admin/config/search/search_api/index/default_node_index/fields
  4. Enable "Entity HTML output". enter image description here
  5. Manage display of your content type /admin/structure/types/manage/article/display
  6. Enable "Search Index" in "Custom display settings" fieldset. enter image description here
  7. Visit /admin/structure/types/manage/article/display/search_index
  8. Add all the fields you want to render. You can extend this display using the regulat hooks, templates and preprocesses if needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.