statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
3.9k stars 520 forks source link

Search Tag does not contain Supplementing Data #10384

Closed jbrhel closed 2 months ago

jbrhel commented 3 months ago

Bug description

After upgrading to version 5.8.0 and higher, the tag {{ search:results ...}} does not display Supplementing Data.

In the collection items for Articles, I have associated the taxonomies tags, categories, and the entity users (authors), but it does not return the expected data and falls back in a cascade to the item's title.

The screenshots show the example before and after version 5.8.0.

The problem is likely in the implementation of PR 323.

How to reproduce

Upgrade to 5.8.0 or higher. Have a search template that refers to related entries or taxonomies."

{{ search:results index="articles" }}
  {{ title }}
  {{ tags }}
    {{ title }}
  {{ /tags }}
{{ /search:results }}

config/statamic/search.php


    'indexes' => [
        'articles' => [
            'driver' => 'local',
            'searchables' => 'collection:articles',
            'fields' => ['title', 'perex', 'article_content'],
        ],
    ]

Cursor-2

Cursor

Logs

No response

Environment

Environment
Application Name: GDPR.cz
Laravel Version: 11.14.0
PHP Version: 8.2.20
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: gdpr.cz.test/
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: redis
Database: mysql
Logs: stack / single
Mail: smtp
Queue: redis
Session: file

Statamic
Addons: 4
Sites: 1
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.12.0 PRO

Statamic Addons
edalzell/forma: 3.0
jacksleight/statamic-bard-mutator: 2.3.1
pecotamic/sitemap: 1.4.7
statamic-rad-pack/mailchimp: 5.0.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

duncanmcclean commented 3 months ago

After upgrading to version 5.8.0 and higher

Which version did you update from?

jbrhel commented 3 months ago

After upgrading to version 5.8.0 and higher

Which version did you update from?

I was on the latest current version. When I identified this problem, I looked in the release updates to see if anything in this area had changed recently. I then went back to version 5.7.3 and the problem wasn’t there. Then I updated to 5.8.0 and the problem started appearing.

jason-beach commented 3 months ago

I'm having a similar issue as well for search:results as I cannot seem to display the author:name. I'm on the latest version of Statamic.

{{ search:results index="blog" }}
  {{ title }}
  {{ author:name }}
{{ /search:results }}

In addition, I'm not able to get the author:avatar either...any thoughts?

If I take this approach, I get an UUID for {{ name }}:

{{ author }}
  {{ name }} // displays UUID
{{ /author }}
chrispclaroty commented 2 months ago

Same exact issue as jbrhel over here, with Livewire-component-based search results. I've been meaning to upgrade from 4.8.2 to the latest version of v5 for a while now and finally made the jump to the latest today. Realized that search results for entries were getting taxonomy and author titles overridden with the entry titles. Assumed it was something with the cascade that changed, but couldn't pinpoint it. Slowly rolled back versions until discovering that the issue was not present in 5.7.3, but appeared in 5.8.0.

Search results are rendered through template output that looks like the following (simplified for this example):

<div>
    {{ topics }}
        <div>{{ title }}</div>
    {{ /topics }}
        <h4>{{ title }}</h4> {{# this is the entry title #}}
    {{ authors }}
        <div>{{ title }}</div>
    {{ /authors }}
</div>

In 5.7.3 and below, the output would be something like:

Cybersecurity Vulnerabilities Access How to Protect Your Organization John Doe

In 5.8.0 and above, the output is now:

How to Protect Your Organization How to Protect Your Organization How to Protect Your Organization How to Protect Your Organization How to Protect Your Organization

Screenshots:

5.7.3 and below: Screenshot 2024-07-27 at 1 32 33 AM

5.8.0 and above: Screenshot 2024-07-27 at 1 31 18 AM

Looks like the issue is closed as of a few hours ago, but happy to provide more details if helpful!!

jasonvarga commented 2 months ago

This has been fixed but not yet released. It will be in 5.18.0.

chrispclaroty commented 2 months ago

Looking forward to it, thank you so much @jasonvarga! 🙏