Skip to content

Commit 1175f95

Browse files
skeptrunedevcdxker
authored andcommitted
feat(trieve-shopify-extension): add default search mode and default search filters for global and inline component
1 parent 10e6946 commit 1175f95

2 files changed

Lines changed: 80 additions & 1 deletion

File tree

clients/trieve-shopify-extension/extensions/global-search/blocks/global_component.liquid

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
useGroupSearch: true,
3737
scaleRem: true,
3838
hideOpenButton: true,
39+
defaultSearchMode: "chat",
3940
apiKey: appMetafieldTrieve.api_key,
4041
datasetId: appMetafieldTrieve.dataset_id,
4142
zIndex: Number(getValue(appMetafieldTrieve.z_index, 2147483645)),
@@ -53,11 +54,49 @@
5354
getCartQuantity: (trackingId) => {
5455
return checkCartQuantity(parseInt(trackingId));
5556
},
57+
searchOptions: {
58+
use_autocomplete: true,
59+
search_type: "fulltext",
60+
typo_options: {
61+
correct_typos: true,
62+
},
63+
filters: {
64+
must: [
65+
{
66+
field: "metadata.variant_inventory",
67+
range: {
68+
gt: 0
69+
}
70+
},
71+
{
72+
field: "metadata.status",
73+
match_all: [
74+
"ACTIVE"
75+
]
76+
}
77+
]
78+
}
79+
},
80+
chatFilters: {
81+
must: [
82+
{
83+
field: "metadata.variant_inventory",
84+
range: {
85+
gt: 0
86+
}
87+
},
88+
{
89+
field: "metadata.status",
90+
match_all: [
91+
"ACTIVE"
92+
]
93+
}
94+
]
95+
},
5696
{% comment %} not on inline {% endcomment %}
5797
showFloatingSearchIcon: toBool(getValue("{{ block.settings.show_floating_search_icon }}", true)),
5898
floatingSearchIconPosition: getValue("{{ block.settings.floating_icon_pos }}", "left"),
5999
allowSwitchingModes: false,
60-
defaultSearchMode: "chat",
61100
});
62101
}
63102
</script>

clients/trieve-shopify-extension/extensions/global-search/blocks/inline_component.liquid

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
useGroupSearch: true,
4747
scaleRem: true,
4848
hideOpenButton: true,
49+
defaultSearchMode: "chat",
4950
apiKey: appMetafieldTrieve.api_key,
5051
datasetId: appMetafieldTrieve.dataset_id,
5152
zIndex: Number(getValue(appMetafieldTrieve.z_index, 2147483645)),
@@ -63,6 +64,45 @@
6364
getCartQuantity: (trackingId) => {
6465
return checkCartQuantity(parseInt(trackingId));
6566
},
67+
searchOptions: {
68+
use_autocomplete: true,
69+
search_type: "fulltext",
70+
typo_options: {
71+
correct_typos: true,
72+
},
73+
filters: {
74+
must: [
75+
{
76+
field: "metadata.variant_inventory",
77+
range: {
78+
gt: 0
79+
}
80+
},
81+
{
82+
field: "metadata.status",
83+
match_all: [
84+
"ACTIVE"
85+
]
86+
}
87+
]
88+
}
89+
},
90+
chatFilters: {
91+
must: [
92+
{
93+
field: "metadata.variant_inventory",
94+
range: {
95+
gt: 0
96+
}
97+
},
98+
{
99+
field: "metadata.status",
100+
match_all: [
101+
"ACTIVE"
102+
]
103+
}
104+
]
105+
},
66106
{% comment %} not on global {% endcomment %}
67107
inlineHeader: "",
68108
inline: true,

0 commit comments

Comments
 (0)