Hello Community,
I am using wix-data > query().contains().find() to return results from the default " Stores/Products " collection. Every field I have tried works fine except no matter what search term I send against the " description " field, I get 0 results.
export async function startSearch(searchItem) {
const resultsName = await wixData.query("Stores/Products").contains("name", searchItem).find();
const resultsDescription = await wixData.query("Stores/Products").contains("description", searchItem).find();
console.log(resultsName.items) //this works great
console.log(resultsDescription.items) // despite search terms that should return results based on my product descriptions this is always an empty array
}
Based on this documentation and the Corvid Reference guide, I know the contains() function should work against the “description” field:
So far I have tried:
-
Switching my asynchronous function back to a synchronous one, same 0 results returned
-
Created a new collection with a similar rich text field and query against that instead using contains(), this worked, but it doesn’t fix my problem as I need to query the “Stores/Products” collection
-
Cleared out and added simple text to a product’s “description” field in the web UI to confirm my broken query results didn’t have something to do with the RTF having odd formatting from the initial data upload. Same 0 results after this.
-
Tried chaining the query to the working one with the or() function. Same results from running the “name” query alone.
I found a few similar threads, but I was not able to get any clarity from them:
I would greatly appreciate any input. I imagine I am missing something simple.
Thank you,
Robert