@masagrator
I changed the text in the advanced filter to "Show entries with NULL value".
Ive also modified the searching. I personally think its too loose because it finds a lot of other junk too but please test for yourself.
Every string in the input filed is split by whitespace into an array, a regex is made out of each item and then all games are looped through and tested against each regex. This means searching just for "doom" will give all games with doom in their name, searching for "doom eternal" will give all games with either the word "doom" or "eternal" in its name (also if the search just a portion of the name) and thus results in much more found entries instead of "narrowing it down".
Not sure if someone here knows some javascript too and can come up with an even better way of searching titles.
I could just loop through the regex array and test each game against the first element, save the matches and testit against the second element and so on but nested for loops should be avoided and it would mean it would loop through all games * the number of words in your search. not a great solution.
The easiest solution would be to go back to the old way but exclude copyright/trademark/... characters from the regex. to do that, i would need to create and maintain a list of characters to ignore. Doing that for every language is not smart unless some genius has implemented something like that into regex
I changed the text in the advanced filter to "Show entries with NULL value".
Ive also modified the searching. I personally think its too loose because it finds a lot of other junk too but please test for yourself.
Every string in the input filed is split by whitespace into an array, a regex is made out of each item and then all games are looped through and tested against each regex. This means searching just for "doom" will give all games with doom in their name, searching for "doom eternal" will give all games with either the word "doom" or "eternal" in its name (also if the search just a portion of the name) and thus results in much more found entries instead of "narrowing it down".
JavaScript:
var inputList = this.search.value.toLowerCase().trim().split(' ');
var regexList = [];
inputList.forEach((el) => {
regexList.push(new RegExp(el));
});
var matchingGames = [];
for (var game in this.allItemsFromJson) {
var filterVal = this.allItemsFromJson[game][filter];
var isMatch = regexList.some((rx) =>
rx.test(filterVal.toString().toLowerCase())
);
if (isMatch) matchingGames.push(this.allItemsFromJson[game]);
}
Not sure if someone here knows some javascript too and can come up with an even better way of searching titles.
I could just loop through the regex array and test each game against the first element, save the matches and testit against the second element and so on but nested for loops should be avoided and it would mean it would loop through all games * the number of words in your search. not a great solution.
The easiest solution would be to go back to the old way but exclude copyright/trademark/... characters from the regex. to do that, i would need to create and maintain a list of characters to ignore. Doing that for every language is not smart unless some genius has implemented something like that into regex
Last edited by Slluxx,