Skip to content

Pattern API: Search requests ignore other API parameters #547

Description

@ryelle

See #540 (comment)

I'm testing the GB PR and it seems can fetch patterns with more blocks, if we also provide the search param, ex:

https://api.wordpress.org/patterns/1.0/?search=image&allowed_blocks[]=core/heading&allowed_blocks[]=core/gallery

Any insights about this?

Probably due to using ElasticSearch for search results.

Sync the wpop_contains_block_types meta and use it for a filter like 29f7b31.

Activity

  1. self-assigned this
    on Jan 9, 2023
  2. ryelle commented on Jan 23, 2023

    @ryelle
    ContributorAuthor

    I think this issue will also happen if the author_name is passed to the API (see #549).

  3. removed their assignment
    on Jan 23, 2023
  4. changed the title [-]Pattern API: Search parameter seems to override the allowed_blocks filter[/-] [+]Pattern API: Search requests ignore other API parameters[/+] on Jan 24, 2023
  5. ryelle commented on Jan 24, 2023

    @ryelle
    ContributorAuthor

    It was noted in #57501-core that the offset, order, and orderby params are not applied to search results in core API requests.

    ❌ Make sure search still works (search):

    /wp-json/wp/v2/pattern-directory/patterns/?search=plants
    🟢 search works alone, and along with the per_page and page parameters.
    🔴 search is not affected by the offset, orderby, or order parameters.

    This is an issue with the wporg API itself— you can test with https://api.wordpress.org/patterns/1.0/?search=form&offset=2. The results don't change despite the offset change.

  6. moved this to 📋 To do in WordPress.orgon Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions