Index Schema
Our plugin formats your data in an optimal and extensible format so that it can better serve your Shopify search experience.
This page will explain how we format your data, how we configure your Algolia indexes, and how to exclude objects from your search results.
Products
Algolia does not directly store products: it stores variants. For products with variants, all variants are treated and uploaded as independent objects: the product itself is not uploaded. For products without variants, the attributes of the product are first put into a schema that parallels the structure of the variant’s schema, and then uploaded.
Schema
In Algolia, we use the following format to store your products:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
objectID, // Variant id (unique identifier also used by Algolia)
sku,
barcode,
id, // Product id
title, // Name of the product
variant_title, // Name of the variant
product_type,
vendor,
handle, // URL handle for the product
tags,
named_tags: { // Key value association from tags like this: "key:value" (See Named tags section)
<TAG_KEY>
},
body_html_safe, // Description (without HTML, truncated to 2000 characters)
compare_at_price, // Initial price
price, // Actual (optionally discounted) price
price_ratio,
price_range,
variants_count, // Total count of the variants of the related product
variants_min_price, // Min price of all the variants of the related product (only relevant with distinct enabled)
variants_max_price, // Max price of all the variants of the related product (only relevant with distinct enabled)
option1, // Variant option 1
option2, // Variant option 2
option3, // Variant option 3
options: { // Hash containing the option `names: value`
<OPTION_NAME>
},
option_names, // Array containing the option names, in order
requires_shipping,
taxable,
grams,
weight, // Weight with its original unit
image,
product_image,
inventory_management, // Inventory management system used
inventory_management_shopify, // Is the inventory management system shopify (1 if yes, 0 if no)
inventory_quantity, // Number of available items in the inventory
position, // Position of the variant in the list of products
template_suffix,
meta: { // Metafields (See Metafields section)
namespace1: {
key1,
key2
},
},
created_at,
updated_at,
published_at,
recently_ordered_count, // How much have recently been ordered : useful for ranking
collections: [
'collection-1-handle' // Array of product collections handles
]
}
The image
attribute uses the variant’s picture if it exists, otherwise, the first picture of the associated product is used.
Searchable Attributes
By default, we perform textual search on the following attributes (they are ranked in order of importance):
vendor
title
variant_title
product_type
tags
handle
sku
barcode
body_html_safe
Displaying by product/most relevant variant
To have only the most relevant variant appear in your search results instead of all variants, select the Show Products option from the Display tab.
Ignoring a product
To remove or hide a product from search results (for example, a private product or a product not yet ready for sale), either:
- Add
algolia-ignore
to its list of tags - Add
[hidden]
to its name (lowercase, with brackets)
Ignoring a variant
To remove a variant from the search results add [hidden]
to its name.
Example: for the color option, a variant name could be “blue”.
Call it blue [hidden]
or [hidden] blue
to avoid indexing it.
The position of the phrase [hidden]
does not matter. It can be at the beginning, middle, or end of the name.
Collections
We store your Shopify collections in Algolia as follows:
Schema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
objectID, // Collection id (in Shopify & Algolia)
title,
handle, // URL handle
body_html, // Description (with HTML, truncated to 2000 characters)
body_html_safe, // Description (without HTML, truncated to 2000 characters)
image,
products_count, // Product count in the collection (not updated in real-time)
template_suffix,
meta: { // Metafields (See Metafields section)
namespace1: {
key1,
key2
},
},
updated_at
}
Searchable attributes
We perform textual search on the following attributes (they are ranked by importance):
title
handle
body_html_safe
Ignoring a collection
To remove a collection from the search results, add [hidden]
to its name (lowercase, with brackets).
For example, for a collection named Summer
, call it Summer [hidden]
or [hidden] Summer
to avoid indexing it.
Articles
We store your Shopify Articles in Algolia as follows:
Schema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
objectID, // Article id (in Shopify & Algolia)
title,
handle, // URL handle
body_html, // Description (with HTML, truncated to 2000 characters)
body_html_safe, // Description (without HTML, truncated to 2000 characters)
image,
tags,
created_at,
updated_at,
meta: {
},
author: {
objectID,
name
},
blog: {
objectID,
title,
handle,
commentable,
feedburner,
feedburner_location,
created_at,
updated_at,
meta
}
}
Searchable attributes
We perform textual search on the following attributes (they are ranked by importance):
title
handle
tags
blog.title
blog.handle
author.name
body_html_safe
Ignoring an article
To remove an article from the search results, either:
- Add
algolia-ignore
to its list of tags - Add
[hidden]
to its name (lowercase, with brackets)
Ignoring a blog entirely
Articles belong to blogs. You can remove all the articles of a specific blog from the search results. To do so, add [hidden]
to the blog name.
Pages
We store your Shopify Pages in Algolia as follows:
Schema
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
title,
author,
created_at,
body_html,
objectID,
updated_at,
meta,
handle,
shop_id,
template_suffix,
published_at,
body_html_safe,
}
Ignoring a page
To remove a page from the search results, either:
- Add
algolia-ignore
to its list of tags - Add
[hidden]
to its name (lowercase, with brackets)