How to make a google-like search engine

Hey everyone! The title says it all.

I basically will create a ton of websites and attribute a name to it. I want it so if the player type on a textbox “houses for sale” it will return the results, but also it will return results if the player makes a typo “hiuses four sale” or use different words, such “homes for sale”

Any help will be highly appreciated!

please don’t tell me I’ll have to use a bunch of if’s:melting_face:

I’m afriad it will be extremely difficult for you to implement.
You will have to add some sort of auto-correct to the search, and run over multiple different possiblities. Autocorrects can be painful in itself to implmenet.

On top of autocorrect, you need to actually search for relevant items, which is also a monumental task, unless you are going to have the user type very specific phrases e.g. ‘houses for sale’, but not ‘house sale’, in which case you can just loop through all possibile searches and find the best one i guess.


Google search is also over 2B lines of code ;-;
image

2 Likes

Oh gosh… This is what I feared…

I’m pretty sure the best bet you could probably do is using a pairs loop through some type of database/table and using string.find to find the keywords. not sure how you would implement misspelling though, or maybe my stupid brain can’t find a solution…

1 Like

Luckily for you, you don’t have to do any web crawling since you’re not making a search engine for the web

You’d have to also add some autocorrect like others have said unless you’d rather not to.

Then you can go thru your webpages and match words with the search query.

here’s the steps you’ll actually need:

  1. create server and do web scraping
    1(a). rank results
  2. make a interface for users to use
  3. make a script that awaits input (and submission)
  4. run thru your scraped sites
  5. match relative words in those sites with your keywords
  6. provide those sites for the user to access
  7. now you’re done :white_check_mark:
1 Like

this video explains the methods used to do search queries, fast (the objective in the video is to make it fast, so It might be overwhelming). However I don’t know if it includes autocorrecting the query. I found an article about recreating google’s spellchecking:

1 Like

Here’s a good video I found like 2 months ago that explains how a spellchecker works if you are gonna proceed with your plan.

1 Like

you can use an ai to check for spelling mistakes and sorting it all maybe thats ur best bet
or you could make an algorithm yourself which will be probably pretty difficult

1 Like