Skip to content

Similar products ​

On a product detail page, Interesting for you is the related-items row. Editor picks come first. When that list has fewer than eight items still available in this store and in stock, CollectStorefrontRelatedItems fills the rest with nearest products from Typesense.

When Typesense runs ​

You open a product. ShowProduct calls CollectStorefrontRelatedItems with the base product.

Editor related items that are still listable in this store stay on the row. If fewer than eight remain, QuerySimilarSearchDocuments asks QuerySearchDocuments for the nearest products in the search collection. The vector query uses this product's document id. It does not call Embeddings again.

HydrateSearchDocuments loads those ids as Product rows. CollectStorefrontRelatedItems then keeps products that are available in the store, in stock on the search card, and not promoted. Cached similar ids skip a second Typesense round trip for about an hour.

ShowProduct maps the mixed list through RelatedItemResource. The Blade partial pages.front.partials.related-items renders the cards.

When Typesense does not run ​

The row is full when eight editor picks are still listable. That path does not call Typesense.

If Typesense fails, QuerySimilarSearchDocuments returns no documents and the page still renders. You only see the editor picks that survived the listable check.

Out of scope ​

The chart is the product-page fill. It does not show Offer Search. See Offer search query. It also does not show how documents are indexed, or related-item rows on articles, media, and challenges.