New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Trouble accessing data from inside collection fieldtype

Oliver Lardner July 10, 2019 by Oliver Lardner

Trying to add a fieldtype (in this case, "artist") to search.

I can add the column in the admin like so:

columns:
  - title
  - artist.title


but doing the same in site/settings/search.yaml
ie:

searchable:
  - title
  - artist.title


still does not open this up to search...

So I went down the rabbit hole, trying to get at it within the search results somehow underneath the artist... ie:

searchable:
  - title
  - artist


This at least adds the id to the search.yaml index, however:

{{ search:results }}
    {{ collection:artworks scope="artwork" }}
        {{ if artist === artwork:artist }}
            <br>{{ title }} (this should be an artwork with the same artist found in the search
        {{ /if }}
    {{ /collection:artworks }}
{{ /search:results }}

this simply does not work.

Any help here would be greatly appreciated!

Answered by Oliver Lardner!
>>>>>>> Answered <<<<<<<
4 Replies
2 Followers