Ask coding questions

← Back to all posts
Need help making serch engine for serch bar that is able to be responsive.
JasonWu19 (9)

I am making a webpage for one of my school webpages and I need help with making a search engine and a responsive search bar with autocomplete someone please help me! And by the way, I have zero idea on how to build a search engine.

Answered by ruiwenge2 (634) [earned 5 cycles]
View Answer
Comments
hotnewtop
ruiwenge2 (634)

well, you can make a list of books like this:

var books = ["Harry Potter", "Percy Jackson"];

next you need to see if the search value is included in the books:

var value = document.querySelector("input").value;
for(let i of books){
  if(i.toLowerCase().includes(value.toLowerCase()){
    alert("there is a book called " + i);
  }
}
JasonWu19 (9)

well im trying to like do a google type search engine where you type in something and click search you will be directed to another page with results.And all the book, story things are all going to be on google [email protected]

ruiwenge2 (634)

@JasonWu19 for that to happen you need a server. i recommend Flask.

ruiwenge2 (634)

@JasonWu19 of course! replit supports it. just create a python repl, and in the examples, you will see a flask example.

ruiwenge2 (634)

@JasonWu19 mark it as correct if it helped!

JasonWu19 (9)

also how do I like make the results show up after a search input was entered? or do I have to do that on the python repl.it or can I still do it on this [email protected]

ruiwenge2 (634)

@JasonWu19 do it on the python repl

JasonWu19 (9)

Can you teach me how though, cause I never used python like this before?And since it is on another epl.it how do I like link rel to [email protected]