Skip to content

Command palette not displaying results from fields other than title #13768

@martyf

Description

@martyf

Bug description

When updating the cp search index to include other fields, results containing those fields are returned from the search endpoint, but are not displayed in the Command Palette.

It appears the server-side part of the Search is working correctly... but results are not correctly displayed.

If you search for the "Title", it appears.

If you search for another field in the Entry, that is configured to be used, it does not appear (but is returned by the search call server-side.

How to reproduce

  1. New Statamic 6 install, no starter kit
  2. Update config/statamic/search.php with the below search config (see below)
  3. Add a new Entry to the Pages collection, and give it a Title of "About"
  4. Add some content to the Markdown field, and include the word "banana" somewhere.
  5. Save
  6. Review storage/statamic/search/cp.json - the "content" field should be in the index for the Entry you just created
  7. Open Dev tools to see Network requests
  8. Cmd+K to load the Command Palette
  9. Search for "bana"
  10. Review the Network Requests, and find the response: it'll be something like:
    [{"category":"Content Search","icon":"entry","keys":null,"text":"About","url":"http:\/\/statamic-6.test\/cp\/collections\/pages\/entries\/091cd1cd-24b9-493e-9881-4b0d8828fc73","openNewTab":null,"trackRecent":true,"badge":"Statamic - Pages","reference":"entry::091cd1cd-24b9-493e-9881-4b0d8828fc73"}]
  11. But the Command Palette will not show the result
Image

At this point, I would expect to see "About" in the list because the Content field has the word "banana" in it, and was returned by the search endpoint.
12. Change search to "About"
13. You will see the result
Image

Search config:

        'cp' => [
            'driver' => 'local',
            'searchables' => ['content', 'users', 'addons'],
            'fields' => ['title', 'content'],
        ],

Logs

Environment

Environment
Application Name: Statamic
Laravel Version: 12.49.0
PHP Version: 8.4.17
Composer Version: 2.9.3
Environment: local
Debug Mode: ENABLED
URL: statamic-6.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

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

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.1.0 PRO

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions