Allow dropdown to search through more than 1,000 lines of data from WIX Database

I have been working on a catalog for auto parts for the past while. After spending weeks scraping and formatting my database to be usable, I was extremely disappointed to find out about the limit of 1,000 lines for my drop-down search.

In short, I have a lot more than 1,000 lines of data in my database, and I need the drop-drown to search through all of it, and display the resulting data in a table.

My website is www.raiken.ca and this function is on my home page.

If I try to increase the limit in my code, the drop-downs will not work.

Unless there’s something wrong with my code, the limit of 1,000 lines will be the reason for me to say goodbye to WIX and find an alternative.

Below is all of my code.


import wixData from “wix-data”;

$w.onReady( function () {
yearDropdownDefault();
});

function yearDropdownDefault() {
wixData.query(“V20181204_556_EB”)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w(“#yearDropdown”).options = buildOptions(uniqueTitles);
});

function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.year);
return [… new Set(titlesOnly)];
}

function buildOptions(uniqueList) {
uniqueList.sort();
uniqueList.reverse();
return uniqueList.map(curr => {
return {label: curr, value: curr};
});
}
}

export function yearDropdown_change(event, $w) {
if ( $w(“#makeDropdown”).enabled ) {
$w(“#makeDropdown”).disable();
$w(“#modelDropdown”).disable();
$w(“#makeDropdown”).selectedIndex = undefined;
$w(“#modelDropdown”).selectedIndex = undefined;
uniqueDropDown2();
uniqueDropDown3();
$w(“#makeDropdown”).enable();
}
else {
uniqueDropDown2();
uniqueDropDown3();
$w(“#makeDropdown”).enable();
}
}

function uniqueDropDown2() {
wixData.query(“V20181204_556_EB”)
.contains(“year”, $w(“#yearDropdown”).value)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w(“#makeDropdown”).options = buildOptions(uniqueTitles);
});

function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.make);
return [… new Set(titlesOnly)];
}

function buildOptions(uniqueList) {
uniqueList.sort();
return uniqueList.map(curr => {
return {
label: curr,
value: curr
};
});
}
}

export function makeDropdown_change(event, $w) {
if ( $w(“#modelDropdown”).enabled ) {
$w(“#modelDropdown”).disable();
$w(“#modelDropdown”).selectedIndex = undefined;
yearDropdownDefault();
uniqueDropDown3();
$w(“#modelDropdown”).enable();
}
else {
yearDropdownDefault();
uniqueDropDown3();
$w(“#modelDropdown”).enable();
}
}

function uniqueDropDown3() {
wixData.query(“V20181204_556_EB”)
.contains(“make”, $w(“#makeDropdown”).value)
.contains(“year”, $w(“#yearDropdown”).value)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w(“#modelDropdown”).options = buildOptions(uniqueTitles);
});

function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.model);
return [… new Set(titlesOnly)];
}

function buildOptions(uniqueList) {
uniqueList.sort();
return uniqueList.map(curr => {
return {
label: curr,
value: curr
};
});
}
}

export function modelDropdown_change(event, $w) {
$w(“#appSearch”).enable();
}

export function appSearch_click(event, $w) {
if ( $w(“#table1”).collapsed ) {
$w(“#table1”).expand();
}
else {
}
ProdResult();
}

function ProdResult() {
$w(‘#dataset1’).setFilter(wixData.filter()
.eq(‘year’, $w(“#yearDropdown”).value)
.eq(‘make’, $w(“#makeDropdown”).value)
.eq(‘model’,$w(“#modelDropdown”).value)
);
$w(‘#dataset1’).refresh()
}


If there is a fix to this, please let me know.

Hey
Do you mean that you want more than 1,000 records inside a Dropdown? That is really a bad decision even if it would be possible. Most browsers will have hickups in all kinds of ways when they should render that. There must be a better way to show the data than a 10 kilometers long drop down?

You can search here in the forum and you will get answers how to get more than 1000 records in one query but I would still believe that it is a very bad user interface solution.

Hello,

No I do not want more than 1,000 records to display inside a drop down, sorry if I confused you with my inquiry.

What I need is for my code to search through all the lines from my database instead of only searching through the first 1,000 lines of data as it’s doing right now.

After duplicated values are removed, I should be left with no more than 40 records for the years drop down (vehicle model years) , no more than 50 records for make (relevant car manufacturers) and probably less than 40 records for car models.

Help will be much appreciated, thanks.

@halfnhalfproduction Ah, okey. Look here for an answer, the answer is in the Top Comment