How to make the search engine

How to make the search engine

The most popular websites on the Internet are search engines. With their help it is always possible to find information necessary to you. Let's try to create own search engine according to that scheme according to which the very first searchers worked. In a consequence you will be able to finish the search engine and to turn it into full and modern. It depends on your abilities and readiness. So, the instruction for creation of meta-search engine is given below.

Instruction

1. Separate the search engine into three parts. The first part is an interface of future web searcher which is written in the PHP language. The second part is an index (My SQL database) in which all information on pages is stored. The third part is search the robot who will index web pages and to enter their data in the index, it is done in the Delphi language.

2. Let's begin to create the interface. Create the index.php file. For this purpose separate the page into two parts, using tables. The first part – a search form, the second – search results. In the top part create a form which will send information to the index.php file by get method. On it three elements – a text box and two more buttons will be located. One button is necessary for sending request, the second – for cleaning of the field (this button is not obligatory).

3. Name the search text box, the first button (to that which sends a request) the name "Look for". Leave a name of the form as is – "form1".

4. Results will be displayed in the lower part of the table by means of php therefore open the tag <? also begin to write php the code.

5. Connect the configuration file to be connected to the database.

include ""config.php"";

Check whether was clicked "Look for".

if (isset ($ _GET ['button'])) {the code executed if "Look for" is clicked } else {the code executed if "Look for" is not clicked }

If it is clicked then check existence of search query.

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

6. If search the request is, then assign to the variable of $search the text of search query.

7. Check request that it was not empty and was not shorter than three characters.

8. if ($search! =" && strlen ($search)> 2) {code of search by the database } else {echo ""Empty Search Query or the Search String Is Set Contains Less than 3 Characters.""; }

If search the request will meet the top condition, start itself search a script.

9. Start a cycle which will display search results through printf.
On it all. If you have necessary knowledge, then you can quite add elements necessary to you to search engine and make the algorithm of its creation.

Author: «MirrorInfo» Dream Team


Print