How to filter repeater dataset by Store/Products collections

Hello,

I am creating my online store and trying to add filter functions by corvid.
Currently, I followed this Youtube video and it has done for search bar.
https://www.youtube.com/watch?v=mTRSPNosLRw&t=39s
However, I couldn’t connect to Products collection’s collections field.

The store filter function doesn’t have a keyword search bar that I am trying to build a Repeater Dataset way.

I am wondering, how can I add a collections field sort function by corvid?
collections field returns “undefined” value that it didn’t work hasSome() filter.

This is my current code.

import wixData from ‘wix-data’;
// For full API documentation, including code examples, visit Velo API Reference - Wix.com

$w.onReady(function () {
//TODO: write your page related code here…
wixData.query(‘Stores/Collections’)
.find()
.then(res => {
let options = [{“value”: ‘’, ‘label’:‘All Catalog’}];
options.push(…res.items.map(catalog => {
return {‘value’: catalog.name, ‘label’: catalog.name}
} ));
$w(‘#catalog’).options = options;
})
});

//filter by keyword
let lastFilterTitle;
let lastFilterCatalog;

let debounceTimer;
export function search_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(()=>{
filter($w(‘#search’).value, lastFilterCatalog);
}, 200);
}

function filter (title, catalog) {
if (lastFilterTitle !== title || lastFilterCatalog !== catalog) {
let newFilter = wixData.filter();
if (title)
newFilter = newFilter.contains(‘name’, title);

	if (catalog)  
		newFilter = newFilter.hasSome('collections', catalog); 
	
	$w('#dataset1').setFilter(newFilter); 
	lastFilterTitle = title; 
	lastFilterCatalog = catalog 
}	 

}

//filter by category

export function catalog_change_1(event) {
filter(lastFilterTitle, $w(‘#catalog’).value);
}

Hopefully, this article can overwhelm the forum.

Many thanks

First off, why not just use the actual tutorial from the examples page in this forum that goes with this youtube Wix video? https://www.youtube.com/watch?v=mTRSPNosLRw&t=39s

You will find that you can open up the page in your own Wix Editor and it will give you all the needed code too. https://www.wix.com/corvid/example/search

However, as for you using query on the Wix Stores app collections…
Which collection are you actually trying to query as you mention Wix Stores Product in your post header and then you actually put Wix Stores Collections in your code sample?

So are you after the Wix Stores Collections collection or the collections field in the Wix Stores Product collection?

See here for all the Wix Stores collections within Corvid and each collections fields and what you can do and can’t do with them in regards to filter, query etc.
https://support.wix.com/en/corvid-by-wix/wix-stores-with-corvid

Also, note that the query examples given in each of the collections does not actually contain the query function, so you will need to add it into your query.

Thank you very much for your comment and suggestions.
I have checked the example code and was trying to that filter to my website.
https://www.wix.com/corvid/example/search

My case is Wix stores and I am going to filter dataset by Stores/Products collection’s “Collections field”.

I checked this article. Wix store product “collections field” can be filtered by hasSome(), but my code didn’t work.
https://support.wix.com/en/article/corvid-wix-stores-product-collection-fields#collections-collections

Also, note that the query examples given in each of the collections does not actually contain the query function, so you will need to add it into your query.
Would it be possible to point where should I fix it? I have been stacking to filter Product dataset by “collections field”.

I attach photos what I want to do by this code that it might clear where are the wrong source code.

Thank you very much

Had you got the answer. I have the same problem.