Home / the Internet / Web programming / How to make your search engine

How to make your search engine


How to make your search engine</a>

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 your own search engine according to the scheme by which the very first search engines worked.

Later you can refine your search engine and turn it into a full-fledged and modern. It depends on your skills and readiness.

So, below is the instruction to create a meta-search engine.



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


Let's start creating an interface. Create an index file.Php. To do this, divide the page into two parts using tables. First part ? Search form, the second? searching results. At the top, create a form that will send information to the index.php file with the get method. Are there three elements on it? Text field and two more buttons. One button is needed to send a request, the second? To clear the field (this button is not required).


Give the text field the name? Search ?, the first button (the one that sends the query) the name? Search ?. Do you leave the name of the form itself, as it is? ? Form1 ?.


The results will be displayed at the bottom of the table with php, so open the & lt-? Php tag and start writing the code.


Connect the configuration file to connect to the database.

Include "config.php"

Check if the "Search" button was pressed.

If (isset ($ _ GET ['button'])) {the code that is executed when the? Search button? Pressed} else {the code that is executed if the button? Search? Not pressed}

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

If (isset ($ _ GET ['search'])) {$ search = $ _ GET ['search'] -}


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


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


If ($ search! = "& Amp; & amp; strlen ($ search) & gt-2) {database search code} else {echo" An empty search term or search string contains less than 3 characters. "-}

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


Run a loop that prints the results of the search through printf.
That's all. If you have the necessary knowledge, then you can completely add the elements you need to the search engine and create your own algorithm for creating it.

How to make your search engine Was last modified: June 20th, 2017 By Riehuosj
It is main inner container footer text