[HELP] How to check if the title of an item has some words that match an element?


So I’m trying to create a list of database items that would work as a “items that are similar to the one you are viewing” list, just like many website like Amazon.

What I’m trying to do is to query the title of the item that is being browsed, and match similar results depending on words that are contained in both the current item, and the items displayed in that list.

For example if the item being displayed is named " PS4 : Spiderman " I want items such as " Spiderman Game" and " Spiderman Artbook" " PS4 : Uncharted" etc… to be displayed in that list.

I tried to apply the “contain” filter, both on the dataset, and with code, but it doesn’t work.

let filter = wixData.filter();
filter = filter
.contains("title", $w("#text54").text)
.contains("categorie", $w("#button31").label);

Thanks !


Setting a dataset’s filter overrides existing filters that were previously set using the setFilter() function or using the Dataset Settings panel in the Editor.

Build and set a dataset’s filter
This example builds a filter based on certain conditions. It then uses the built filter to filter a dataset.

import wixData from 'wix-data';

// ...

function filter(low, high) {
let filter = wixData.filter();

if(low) {
filter = filter.ge("price", low);

if(high) {
filter = filter.le("length", high);