UPDATE 2: Support staff responded. Contains fails on any fields marked with PII status (Personally Identifiable Information) within a database collection. Since this status encrypts the fields and stores the encryptions, contains searches against the encryptions instead of the actual values.
-
Funny enough despite collections de-encrypting the data within the Content Manager view, searches will still fail on PII fields, as the search filter still searches the encrypted versions, instead of the easily ready and already de-crypted versions avaliable
-
This is not mentioned or documented in the documentation despite completely changing the expected operations of both versions of .contains() (data query and data filter functions). The best reference is only mentioned in a single line in this obscure support page (classic Wix).
Overall, if you want to filter or search for information in the future do not use the Personally Identifiable Information feature in the Content Manager.
–July 30th
UPDATE: Search even fails within the content manager collection to recognize certain ‘Text’ fields. There seems to be rules around what is parsed as text, or special characters that break Text fields and make them unparsable to Wix’s internal code. There’s no documentation on these Text rules, so it’s still my best guess but the fields being ignored by Wix’s search options often include “/”, “-”, and “:” and I believe the combination of these, is causing the text search failures in Wix’s code.
–July 23rd
I noticed my search filters not working across the site. On review, it seems to be breaking whenever I use the search input which was linked to .contains() calls. The search query breaks up the search input into terms, then chains filters together using .or() which each query for their own contains() results.
I noticed these queries were giving 0 results when valid search results existed, then that they always gave 0 results no matter what was given as long as .contains() was used. I started testing the problem, and even tried a direct query using WixData’s .contains() instead of the data filter version.
It also failed to find valid results in any field I tested. The collection name is correct, and the field names tested were correct, but no results. It always returns an empty array. I don’t know why this suddenly changed, but I’ll be reporting it to Wix support.
Anyone experiencing similar?
1 Like
You are talking about a filter-function, but do not show any code-line.
How somebody can help you, without seeing your current working (or not working) code?
Please paste your code into a CODE-BLOCK, to solve the whole mystery.
You did not read the post. I am talking about both the data filter function and the data query functions. Please re-read the post. The problem is not code specific. It’s platform based.
In either case, if you need code to understand here are examples that failed:
Both follow the documentation formats and stopped working suddenly without changes being made.
//Data Query .contains()
wixData.query("Registrations")
.contains("primary", "John")
.find()
.then( (results) => {
console.log(results.items); //no results
})
//Data Filter .contains()
$w('#myDataset').setFilter( wixData.filter().contains("primary", "John"))
.then(()=>{
//dataset count 0
});
In the code example, the collection id is accurate, the field names are accurate, and valid names are contained in these fields for items in the collection. For the dataset filter, the dataset is connected properly to the collection.
Try this SETUP…—> WORKING by CODE.
import wixData from "wix-data";
//----- User-Interface --------------------
const DATABASE = "Registrations"
const DATAFIELD = "primary"
const VALUE = "John" //<-- Pay attention for --> Case-sensetivity!
const TABLE = "#myTableIDhere"
const SEARCHBUTTON = "#mySearchButtonIDhere"
//----- User-Interface --------------------
$w.onReady(function() {console.log("Page is ready!")
setupTable();
$w(SEARCHBUTTON).onClick(()=>{console.log("Searchbutton-Clicked")
wixData.query(DATABASE)
.contains(DATAFIELD, VALUE).find()
.then((results) => {console.log(results.items);})
.catch((err)=>{console.log(err)});
});
});
function setupTable(){console.log("Table-Setup running...")
$w(TABLE).columns = [
{
"id": "col1",
"dataPath": "title", // <<--- here you can define the right datapath...
"label": "Title",
"width": 100,
"type": "string",
},
];
}
Disconnect all your dataset connectivity. Now you will try to solve it by CODE!
Place a TABLE onto your page. —> “#myTableIDhere”
Place a SEARCH-BUTTON onto your page —> “mySearchButtonIDhere”
Configure/setup all IDs & values in the USER-INTERFACE.
@marlowe-shaeffer Any ideas what invalidates Text internally in Wix? Have you seen anything like this before?
Hi James,
I haven’t heard this issue before, but I will ask the team about it. And if there are unwritten rules, we will get them documented. I’ll report back as soon as I have more info.
@marlowe-shaeffer Thank you so much! I am waiting on a developer team response through support but they have yet to answer after asking me to explain the issue again
@jamesmrobertsonwork Hi James, There aren’t any limitations, and the team is still looking into the issue. Thanks for your patience.
@marlowe-shaeffer Support staff found the cause: .contains() functions, and all other filter and query functions with fail if a field in the Content Manager is marked as Personally Identifiable Information. This should be clearly defined in both the data queries and data filters docs but was left undocumented
It’s important this is added to these functions since this poses a massive limitation over them and their intended use
@jamesmrobertsonwork Thanks! I’ll notify our documentation team. Glad you got it resolved!
Yeah we have been trying to fix our search input bar for days on end. We found that symbols were in some of our database fields which we thought did the trick, but days later it’s happened again. Our field the the code works with in the database is a String, therefore any characters won’t allow it to work at all. We removed the characters but like I said it’s happened again. I think the backend of Wix is messed up and adding characters to search inputs. Everytime someone searches it brings up the same item over and over again. We are going to have to remove our search and look for alternative ways to achieve it.
Since I was dealing with the .contains problem I got a lot of experience with database searching. If you share you filter or query code I’ll look it over. Also if you include the field settings from the database Content Manager, because that can effect the results too