Having trouble getting autocomplete.js to display results after starting a third word in the search

I have been trying to use an autocomplete library from https://tarekraafat.github.io/autoComplete.js/#/ called autocomplete.js. It is working fine all the way up until I start to add a third word to the query. When I get to the third word, even after one or two characters, I get get “no results found”, but otherwise I get no errors in the console.

If you run the code below, you will see what happens.

Somehow, typing a third word into the search box is causing it to lose the data somewhere between returning the results from the API, and when it gets to resultsList.element. I see no problems with data.src. Can anyone else see any problems with this code?

Here is the code I’m using:

    const autoCompleteJS = new autoComplete({
        selector: "#autoComplete",
        data: {
            src: [
                "Don't Rock The Jukebox - Alan Jackson [CB Karaoke]",
                "Don't Rock The Jukebox - Alan Jackson [NU Karaoke]",
                "Don't Rock The Jukebox - Alan Jackson [DK Karaoke]",
                "Don't Rock The Jukebox - Alan Jackson [SC Karaoke]",
                "Don't Rock The Jukebox - Alan Jackson [P Karaoke]"
            ],
            cache: false // Disable caching for dynamic data
        },
        threshold: 3, // Minimum number of characters before the autocomplete starts
        debounce: 300, // Wait 300ms before fetching the data
        resultsList: {
            element: (list, data) => {
                // Display "No Results" message when no results are found
                if (!data.results.length) {
                    console.log("no results");
                    const message = document.createElement("div");
                    message.setAttribute("class", "no_results");
                    message.innerHTML = `<span>No results found</span>`;
                    list.appendChild(message);
                }
            },
            maxResults: 10, // Maximum number of results to show
            noResults: true
        },
        resultItem: {
            highlight: true,
            element: (item, data) => {
                console.log("data: " + data)
                // Display the result item
                item.innerHTML = `<span>${data.value}</span>`;
            }
        },
        onSelection: (feedback) => {
            const selection = feedback.selection.value;
            document.querySelector("#autoComplete").value = selection;
            console.log("Selected item:", selection);
        }
    });
<link href="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected]/dist/css/autoComplete.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected]/dist/autoComplete.min.js"></script>
<div class="container mt-5 pt-5 col-md-5">
    <h4>Search Songs</h4>
    <div id="autocomplete" class="autocomplete">
        <input id="autoComplete" type="text" placeholder="Search Karaoke">
        <ul class="autocomplete-result-list"></ul>
    </div>
</div>

EDIT:
I think I figured something out. This library seems to want to search through the results on its own. It doesn’t respect the search results I feed it. As long as the words I type are together in the results, it displays them. Is there a way to keep it from doing its own sorting?

I figured it out. As I suspected, this library tries to do its own search on the results I already filtered in the API. It’s not as intelligent of a search as mine, so it blocks the results if I type, for instance, “Alan Jackson Jukebox”, where my search will recognize it.

Anyway, they don’t exactly have a way to directly disable it, but you can put in a function that returns true. And no, setting it directly to true doesn’t work for some reason. Setting it to ‘loose’ doesn’t do it either.

const autoCompleteJS = new autoComplete({
        selector: "#autoComplete",
        data: {
            src: [
                "Don't Rock The Jukebox - Alan Jackson [CB Karaoke]",
                "Don't Rock The Jukebox - Alan Jackson [NU Karaoke]",
                "Don't Rock The Jukebox - Alan Jackson [DK Karaoke]",
                "Don't Rock The Jukebox - Alan Jackson [SC Karaoke]",
                "Don't Rock The Jukebox - Alan Jackson [P Karaoke]"
            ],
            cache: false // Disable caching for dynamic data
        },
        searchEngine: (query, record) => {
            return true
        },
        threshold: 3, // Minimum number of characters before the autocomplete starts
        debounce: 300, // Wait 300ms before fetching the data
        resultsList: {
            element: (list, data) => {
                // Display "No Results" message when no results are found
                if (!data.results.length) {
                    console.log("no results");
                    const message = document.createElement("div");
                    message.setAttribute("class", "no_results");
                    message.innerHTML = `<span>No results found</span>`;
                    list.appendChild(message);
                }
            },
            maxResults: 10, // Maximum number of results to show
            noResults: true
        },
        resultItem: {
            highlight: true,
            element: (item, data) => {
                console.log("data: " + data)
                // Display the result item
                item.innerHTML = `<span>${data.value}</span>`;
            }
        },
        onSelection: (feedback) => {
            const selection = feedback.selection.value;
            document.querySelector("#autoComplete").value = selection;
            console.log("Selected item:", selection);
        }
    });
<link href="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected]/dist/css/autoComplete.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected]/dist/autoComplete.min.js"></script>
<h4>Search Songs</h4>
<div id="autocomplete" class="autocomplete">
    <input id="autoComplete" type="text" placeholder="Search Karaoke">
    <ul class="autocomplete-result-list"></ul>
</div>

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật