🇦🇺Australia @gaellafond

Account created on 16 March 2010, almost 15 years ago
#

Recent comments

🇦🇺Australia gaellafond

It depend what you are trying to do.

For example, my Article node type have a Body field which uses Paragraph. The editor can add as many "Text" paragraph type as he want in the body.

If I index the body as a field of Article, and I search for a word that appears in multiple paragraphs in that article (let's say the made up word "krfuaaxvndhgzrr"), I get one result with multiple text chunks in the excerpt:

Dummy article

… First text krfuaaxvndhgzrr done. … Second text krfuaaxvndhgzrr done. …

If I index the paragraphs as a Datasource, each Text paragraphs become an individual entry in the search index, therefore I end up with duplicate search results:

Dummy article > Body

… First text krfuaaxvndhgzrr done. …

Dummy article > Body

… Second text krfuaaxvndhgzrr done. …

🇦🇺Australia gaellafond

That's what I was looking for. I'm quite disappointed that the feature will not be implemented.

For example, with this feature the following scenario would be possible: We have an image media type. The image has a "licence" field. The user can start typing "creative" and see all the creative common licences (auto-complete taxonomy). If he want to supply a different licence, he just type it and that new licence is added to the list.

We do not want to pre-populate the vocabulary with all the possible licences, their are just too many. We do not want to restrict it to a preset. We do not want to ask our content editor to have to navigate to the taxonomy management section of the website just to add a licence that is not in the list.

The licence field is just an example. We have several field where such a feature would be very useful.

🇦🇺Australia gaellafond

I solve it.

I could not find any example nor documentation. It was a game of try and failure.

I ended up asking GPT-4. It suggested to try with 'type' => 'media--image'. That works.

I guess the issue now is... why Drupal doesn't give an error when I use file--file?

🇦🇺Australia gaellafond

I believe the issue might be due to the insertion of a "file--file" for a "Reference > Media" field type. I can not find any example of a JSON:API query which insert a media, so I have no way of verifying this.

Production build 0.71.5 2024