Score:2

Search API fulltext search that includes entity reference fields in the 'search index' display mode: Is this the correct configuration?

pe flag

To get entity reference field values (not IDs) to work in full text search, is it necessary to add each entity reference field's "name" to the index as a separate field of the fulltext type?

Background: Using DB backend with multiple content types, each having several entity reference fields for taxonomy terms in different vocabularies.

I included all of these entity reference fields in the "search index" display mode for each content type.

  • Searching for unique values in any of those entity reference fields got a no-hits result.

All the other fields included in the search index display mode for each content type worked as expected-- except Title.

What I did that works (so far)

Because I'd had a title issue before, I added it individually to the index as a fulltext type field, then enabled the HTML filter for it.

That made the title work in searches.

As a wild guess, I attempted the same with several of my entity reference fields, specifically adding the taxonomy term name for each field ("...entity:name").

I set each to fulltext type and enabled the HTML processor.

These fields' values now get search hits in the fulltext search.

So my question is, is this how it's supposed to work or did I miss a simpler/correct way to do it? It seems redundant to have a search index display mode and have fields in that display mode that are not searchable (title and entity reference).

I decided not to put this one in the issue queue yet, because I've already got an item or two there... and want to prioritize. And maybe this is already a 'works as designed,' and I'm just not seeing the sense in it.

One more detail: before adding these fields to the index individually, I attempted different field format settings for each of them in the search index display mode. Reindexed after each change. This had no impact in my tests.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.