Search Engine

{ From Scratch }

# CHAPTER 2

How Google Works

Working

Crawling

Gets images, text, links from the websites found on the internet with an automated bot. Bot visits random website through the links found.

1.

2.

Parsing

Analyze what the website is all about. Extracts main keywords from the crawled website and saves meaningful results to the database.

3.

Indexing

Meaningful result should be presented to the user. So, website is ranked on the basis of load time, main keywords, title, description, etc.

# 3 Stages

Crawling

Gets images, text, links from the websites found on the internet with an automated bot. Bot visits random website through the links found.

1.

# 1 Crawling

Crawling

Gets images, text, links from the websites found on the internet with an automated bot. Bot visits random website through the links found.

1.

# 1 Crawling
const urlKeywords = getSubdirectory(url);
const loadingTime = await checkLoading(page);
const details = await pageContent(page);
const images = await getImages(page);
const innerLinks = await getLinks(page);

2.

Parsing

Analyze what the website is all about. Extracts main keywords from the crawled website and saves meaningful results to the database.

# 2. Parsing
# 2. Parsing

Images

Data

Links

  • Title
  • Meta Description
  • OG Details
  • Headings
  • Twitter Details

- reusable low Earth orbital

- National Aeronautics and Space       Administration

- spacecraft

- spaceplane

# 2. Parsing

Images

Data

Links

  • Title
  • Meta Description
  • OG Details
  • Headings
  • Twitter Details
  • First few lines
  • Keywords (meta)
  • Strong text
  • Section (top)
  • Paragraph
  • Table (heading, caption, etc)

- reusable low Earth orbital

- National Aeronautics and Space       Administration

- spacecraft

- spaceplane

- Space Shuttle Program

- Space transportation system

- STS-1

- STS-5

- Kennedy Space Center

- Florida

- satellites

# 2. Parsing

Links

- reusable low Earth orbital

- National Aeronautics and Space       Administration

- spacecraft

- spaceplane

- Space Shuttle Program

- Space transportation system

- STS-1

- STS-5

- Kennedy Space Center

- Florida

- satellites

3.

Indexing

Meaningful result should be presented to the user. So, website is ranked on the basis of load time, main keywords, title, description, etc.

# 3 Indexing
# 3 Indexing
# 3 Indexing
# Tools

Tools required

  1. Database
  2. Frontend (React, Vue)
  3. Backend (Express, Django)
  4. Scraping Library (Puppeteer, Selenium)

An example

I have recently built a search engine from scratch using javascript. You can view it on GitHub.

Code

By Aashish Panthi