Input Value Redirect

Here you can test the function and see how it works…
https://www.media-junkie.com/test-database

Working code…

import wixData from 'wix-data';
import wixLocation from'wix-location';

//------User-Interface---------
var DATABASE = "TEST-DB" //<---- put in here the ID of your new DB !
var inputDATAFIELD = "index" //<-- put in here the ID of your input- DATAFIELD (INDEX)
var outputDATAFIELD = "url" //<-- This will be the output ---> URL
//------User-Interface---------

var myValue  

$w.onReady(()=>{ 
   $w('#input1').onChange(()=>{
      myValue = $w('#input1').value
      console.log("My value "+ myValue +" setted!") 
 });
 
   $w('#button1').onClick(()=>{console.log("Button-1 clicked!") 
      searchIndex(myValue) 
 }); 
});

function searchIndex(VALUE){console.log("Searchfunction started. Value = ", VALUE)
   wixData.query(DATABASE) 
 .eq(inputDATAFIELD, VALUE) 
 .find()
 .then(async(results) => {
 let items = await results.items; console.log(items)
 if(items.length > 0) {console.log("Item found! Redirection starts in 3-secs.")
 let myURL = await results.items[0][outputDATAFIELD]; console.log("Item-URL: ", myURL)
        wixLocation.to(myURL)
 }else {console.log("No matching data found in DB.")}
 })
}

It has just one little difference to your version. My version uses STRING instead of NUMBERS for —> “index”