WordPress / WordPress/pattern-directory

Pattern API: Search requests ignore other API parameters

Open
#547 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

[Component] Pattern Directory API Help Wanted
Dominant language
PHP
Stars
134
Forks
46
Avg merge
9h 4m
Merged PRs (30d)
19

Description

See https://github.com/WordPress/pattern-directory/pull/540#issuecomment-1375377118

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 https://github.com/WordPress/pattern-directory/commit/29f7b31a8c4142f068a2076935fd3583584b27eb.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the patterns API search handling and compare it with commit 29f7b31a8c4142f068a2076935fd3583584b27eb. Review how wpop_contains_block_types is synchronized and filtered when the API request includes search and allowed_blocks[]. Done means the example request applies both search and allowed_blocks[] constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, php
Domain
api, backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.