How To Make Your Own Search Engine

Table of contents:

How To Make Your Own Search Engine
How To Make Your Own Search Engine

Video: How To Make Your Own Search Engine

Video: How To Make Your Own Search Engine
Video: Can I Make A Search Engine From Scratch? 2024, December
Anonim

The most popular sites on the Internet are search engines. With their help, you can always find the information you need. Let's try to create our own search engine in the same way as the very first search engines worked. Subsequently, you can modify your search engine and turn it into a full-fledged and modern one. It depends on your skill and willingness. So, below are the instructions for creating a meta search engine.

How to make your own search engine
How to make your own search engine

Instructions

Step 1

Divide your search engine into three parts. The first part is the interface of the future web search engine, which is written in PHP. The second part is the index (My SQL database), which stores all the information about the pages. The third part is a search robot that will index web pages and enter their data into the index, it is done in the Delphi language.

Step 2

Let's start creating the interface. Create index.php file. To do this, divide the page into two using tables. The first part is the search form, the second is the search results. At the top, create a form that will send information to the index.php file using the get method. There will be three elements on it - a text field and two more buttons. One button is needed to send a request, the second - to clear the field (this button is optional).

Step 3

Name the text field "search", the first button (the one that sends the request) the name "Search". Leave the name of the form as it is - "form1".

Step 4

The results will be displayed at the bottom of the table using php, so open the <? Php tag and start coding.

Step 5

Connect the config file to connect to the database.

include "config.php";

Check if the "Search" button was clicked.

if (isset ($ _ GET ['button'])) {code executed if the "Search" button is pressed} else {code executed if the "Search" button is not pressed}

If the button is clicked, then check for a search query.

if (isset ($ _ GET ['search'])) {$ search = $ _ GET ['search'];}

Step 6

If there is a search query, then assign the text of the search query to the $ search variable.

Step 7

Check the request so that it is not empty and is not shorter than three characters.

Step 8

if ($ search! = '' && strlen ($ search)> 2) {database search code} else {echo "An empty search query was specified or the search string contains less than 3 characters.";}

In the event that the search query satisfies the upper condition, run the search script itself.

Step 9

Run a loop that will print the search results through printf.

That's all. If you have the necessary knowledge, then you may well add the elements you need to the search engine and draw up your own algorithm for its creation.

Recommended: