Metaobject filter + search term not working together

Short description of issue

When executing a search query, if the query is a normal term (no wildcard) and is combined with a metaobject based filter, the results are incorrect

Reproduction steps

Execute a search query that returns a product without any filters → see product result
Execute a search query that returns a product with a metaobject based filter (one that matches the previously returned product) → See no product result
Execute a search query that returns a product with a metaobject based filter, with the searchterm set to * a wildcard → See product result

Additional info

This store has products with a metafield called models. This metafield is a list of metaobjects.
On the storefront we allow users to make a search with a searchterm, where we append the metaobject filter.
Independantly, the metaobject filter returns the correct result as well as the searchterm only.
If a ‘real’ searchterm is combined with this filter, it doesn’t return any results. E.G:

/search?type=product&q=15225488 → returns 1 product
/search?type=product&filter.p.m.custom.models=gid%3A%2F%2Fshopify%2FMetaobject%2F194492498247&q=15225488 → returns 0 products
/search?filter.p.m.custom.models=gid%3A%2F%2Fshopify%2FMetaobject%2F194492498247&type=product → returns products, including the product with id 15225488.

What type of topic is this

Troubleshooting

If its helpful I would be able to share shop details in DM.

Hey @Tristan_Kirwan - thanks for flagging this.

Could you test a couple variants here so we can narrow down where the issue might be happening there?

Is 15225488 matching a product-level field, like product title/tag/vendor/product type, or is it matching a variant field like SKU/barcode? If it’s a SKU/barcode value, could you try the same filter with a field-scoped query?

  • q=variants.sku:15225488
  • q=variants.barcode:15225488, if applicable

Could you also try the same metaobject filter with a search term from the product title or tag, just to see whether product-level search behaves differently from variant-level search?

From what you shared, it looks like the filter works on its own and the search term works on its own, so the combined case is the key part to isolate. If you’d rather share the shop/product details privately after those tests, I can set up a DM on my end here. Let me know what you see from the above.

Hi Alan,

Sorry, I understand the confusion, 15225488 is already part of the product title, the same result happens when I search for diaphragm. (The product is called Diaphragm (15225488)).

For good measure I also tried searching on the product id (rdr00100001), which produces the same result in both cases.

If it helps you, you can open up a DM channel and I’ll share the store details.

Hey @Tristan_Kirwan - no worries! Sending you a DM now :slight_smile: