Delete Tags suggestion in CMS Database

Hello everyone,

I use a CMS database for our animal adoption website. Our customers can filter for different animals on the website. Our employees enter the animal in the database and use tags so that our customers can find the animals. The tags are automatically saved and suggested by the system. Unfortunately, an employee has written the tag in full and put a space after it. Wix has saved this “new” tag directly and also suggests it for all other animals. The problem is that I can’t get the suggestion deleted. It always looks like this:

How can I delete the wrong (or alternatively all) suggestion?

Dieses Phänomen kommt aus deiner DATENBANK !!!
Berichtige die Falscheinträge/Falscheintrag in deiner Datenbank und schon wird die DOPPELTE AUSWAHL wieder verschwunden sein.

Danke für deine schnelle Antwort :slight_smile: Genau das will ich, aber weiß nicht wie :smiley:

Damit es keine Missverständnisse gibt, poste ich noch die dazugehörigen Screenshots:


→ Das ist die Datenbank mit den entsprechenden Einträgen. Bei dem Punkt Geschlecht gibt es die Tags (die dann auf der Website als Filter für die Interessenten dienen).

Wenn ein neues Tier eingestellt wird (also ein neues Element in der Datenbank hinzugefügt) werden die Eigenschaften in die Masken eingetragen und hier tritt dann der o.g. Fehler auf.

Auf der Website ist alles okay, aber es verwirrt die Einsteller weil der falsche Eintrag ein Leerzeichen hinten dran hat und dadurch der Filter nicht mehr funktioniert. Ich hoffe, du weiß was ich meine :slight_smile:

Also, ich werde das jetzt mal auf Englisch beschreiben, da dieses Forum auf Englisch zu halten ist, aber das kannst du ja.

You have the following possibilities to solve your issue:

  1. You edit manually the wrong entries inside of your database, clicking onto the corresponding TAG-FIELD and remove the wrong entry and type it in again including the right value.

  2. You generate some code (function) which will do this job for you → scanning your database for wrong or similar entries → editing or removing them. → 1-click-solution → meaning the whole correction-process will be processed just by one click in seconds, scanning your entire database and removing alsmost identical (wrong) entries in your database.

How to do so ? NOW PAY ATTENTION → YOUR LEARNING MOMENT !!!

  1. Navigate to → JS-FIDDLE —> https://jsfiddle.net/
  2. Put my example code to the JS-SECTION of the JS-Fiddle-Editor…
function filterCorrectSpellings(words, correctWords) {
    return words.filter(word => correctWords.includes(word));
}

// Example usage:
const wordsToFilter = ['apfel', 'apfel', 'bannane', 'banane', 'banan', 'banane_'];
const correctWords = ['apfel', 'banane'];

const correctSpellings = filterCorrectSpellings(wordsToFilter, correctWords);
console.log(correctSpellings); // Output: ['apfel', 'apfel', 'banane', 'banane']

Will look like…

  1. Run the shown code…
    2024-03-25 18_28_13-JSFiddle - Code Playground

  2. Pay attention on to the OUTPUT inside the CONSOLE…
    2024-03-25 18_28_49-JSFiddle - Code Playground

  3. In this example i have 2 different ARRAYs → which are representing your TAGS.

// Example usage:
const wordsToFilter = ['apfel', 'apfel', 'bannane', 'banane', 'banan', 'banane_'];
const correctWords = ['apfel', 'banane'];

The words to filter → will represent your DATABASE (all TAG-DATA including wrong entries) as you can see.

The second ARRAY, is the ARRAY where you will put in the right spelling-words. You will GO only for those WORDS to be FILTERED out of your whole database.

You already can see the results…
2024-03-25 18_32_09-JSFiddle - Code Playground

ONLY THOSE WERE FOUND → WHICH ALSO ARE ALLOWED TO BE FOUND.

But this of course is just a part of the functionality you need.
Surely you do NOT want to maintain your RIGHT-WORDS-ARRAY → manually and adding each time a new correct value into this array → expand the filter-function.

Of course you will want to fill this SECURITY-ARRAY automatically with new entries.

How to do so? Well, here it will get tricky.

  • You could expand your code by using → RegEx

Ok, let’s moving forward —> our new code would look something like…

function filterCorrectSpellings(words) {
    const correctWords = words.filter(word => !/\s|_/.test(word));
    return correctWords;
}

// Example usage:
const wordsToFilter = ['apfel', 'apfel ', 'bannane', 'banane', 'banan', 'banane_'];
const correctWords = filterCorrectSpellings(wordsToFilter);
console.log(correctWords); // Output: ['apfel', 'apfel', 'banane', 'banane']

And our results would look like ...
2024-03-25 18_40_32-JSFiddle - Code Playground

In this case, we used RegEx to find IRREGULARITIES inside of our VALUES.
But as you can see → the function was not able to filter out wrong spellings like…

-bannane
-banan

So, this is why you will need somekind of a combination of both function, where you fill manualy aswell as aoutomaticaly an array of correct words [SECURITY-ARRAY] which will then filter out all IRREGULARITIES and WRONG-SPELLINGS out of your database.

Of course this was just a simple example and you will have to put even more efforts to generate such an automation, which will keep your database always CLEAN from → irregular or wrong spelled (entered) VALUES in your DATABASE.