2

I’m wondering if it’s possible to add non-indexed fields to a search API indexed view?

I want the standard flags fields to be available on the indexed search view. And I was thinking I could do this with relationships but nothing shows up as an option.

EDIT: I was using a taxonomy view until my needs required a more robust filtering system, hence the switch to search API. With facets, it gives me robust filtering options so I can segment my content better than taxonomy alone.

I am building a flashcard website and using Views to display the flashcards and Flags to allow users to mark the flashcards as complete once they memorize the card. This way it can be removed from the main view depending on the status of the flag. So if it isn't flagged it's in the flashcard View, and if they flag it, then it gets removed from the view and I have an attached view, where it will then be listed as memorized.

I will need all of the standard Flags Views integration options to replicate what I was doing before with my taxonomy view. Otherwise, I will have to patch the Flags module or find an alternative to flags.

2 Answers 2

0

If you were using Drupal 7 and Apache Solr, you could get something like this with the Apache Solr Display module:

https://www.drupal.org/project/apachesolr_display

The advantage here is that you can store rendered entity or entity json encoded object inside the Solr index, which allows you to access non-indexed fields. Otherwise you would need to load the node to access those fields.

I'm not sure if there is any analogous module for Drupal 8, but a similar approach might work.

3
  • When you say “otherwise you would need to load the node” what do you mean? For now I’m using database index. I was hoping I could just reference the indexed mode and access the non indexed fields for display
    – Anon Ymous
    Commented Oct 20, 2018 at 16:05
  • I'm sorry. I answered too quickly and did not realize you were using Views. I have used the Apache Solr Display module to access fields in *.tpl.php files. Maybe someone else will have a better answer. Commented Oct 20, 2018 at 19:40
  • Thanks for trying. I updated my main post to explain my situation further, if that helps clarify.
    – Anon Ymous
    Commented Oct 20, 2018 at 19:55
0

From my understanding of the problem so far, try indexing the field which stores the relationship data. After that, you should most probably get an option to create a views relationship.

Example: If you have a taxonomy term reference at field_categories, then add the field_categories to the search index. Once done, you should get an option to create a relationship with the taxonomy term in the views UI.

A more detailed explanation of the problem will be helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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