Code Php Tìm Kiếm Giống Google

Search engine has become a useful tool in today"s mạng internet world. In this article we will evaluate its different uses, basics và tools



Search engine has become auseful tool in today"s internet world. It is very helpful for developers,testers, managers và other mạng internet users. Using this we can get theinformation on any topic of our choice. In this article, we will talk aboutcreating our own tìm kiếm engine with the help of PHP và MySQL. Our goal is notto replace the big giants e.g. Google, Yahoo etc but to give a good attempt inorder khổng lồ have our own search engine. In this article we will talk about thebasics of tìm kiếm engine & then see how to develop our own tìm kiếm engine usingPHPhường and MySquốc lộ.

What is a tìm kiếm engine?

Atìm kiếm engine is a web-based tool which allows the internet users khổng lồ find informationon the mạng internet. Most commonly used search engines are Google, Yahoo!, MSN,Bing, Ask etc. Search engines are special types of programs used to searchdocuments having specified keyword and returns alist of documents where the từ khoá are located. Asearch engine is usually a general collectionof programs. However, the term ‘tìm kiếm engine’is often used to generally describe the comtháng systems lượt thích Google, Bing andYahoo! Search engines generally use automated software applications e.g robots or spiders which moves across the Webvà follows the links from page to page, site to site. The information collectedby these crawlers is used khổng lồ create a searchable index of the Web.

Bạn đang xem: Code php tìm kiếm giống google

How do search engines work?

Anytìm kiếm engine used is based on several complex mathematical formulae used togenerate the search results. The results obtained for the specific query arethen displayed on the SERP.. or the SERP. Search enginealgorithms fetch the key elements from the website page which includes the pagetitle, nội dung and the từ khóa mật độ trùng lặp từ khóa. It then comes up with a ranking basedon which the results are placed on the pages. Each và every search engine hasits own unique algorithm. Hence a search result which has a top ranking onYahoo does not guarantee a similar ranking on Google and vice versa. Thesesearch algorithms which are used by tìm kiếm engines are

very closely guarded secrets,they also constantly undergo modification& revision.

Thusthe criteria lớn best optimize a site should be checked through constant observation,along with several attempts not just once, but should be done continuously.

It isgenerally said that the less reputed SEO (Search Engine Optimization) firms hype,since the answer khổng lồ better site rankings will work at its best for only a limitedperiod till the time the developers of the search engine become wise enough tothe tactics và change their algorithm. Normally sites using these tricks are labeledas spam by the tìm kiếm engines & as a consequence, their rankings go down.

Searchengines only check the texts on web pages, và use the underlying HTMLstructure in order to lớn find out the relevance. Images, photos, or dynamic Flashanimated contents are meaningless lớn tìm kiếm engines; however, the actual textcontent is more relevant for the search engines. It is a challenging task forthe flash developers lớn build a Flash site which will be friendly khổng lồ the searchengines. As a result, the flash sites will tend not lớn rank as high as comparedkhổng lồ sites which are developed with well coded HTML and CSS (Cascading StyleSheets — a complex mechanism for adding styles to trang web pages above andbeyond regular HTML). If the terms, weare looking lớn be found by bởi vì not appear in the text of our website, it will bevery difficult for the website to produces a high placement on the Search EngineResult Pages.

Web Search Engines

Wenormally refer lớn Web Search Engine while talking about Search Engines. A typicalWeb Search Engine starts working by sending out a spider whichhas the ability to lớn fetch as many documents as possible against the suppliedkeywords. There is another program called the indexer, & then starts reading these documents & starts creatingthe indices based on the tokens found in each document. Each tìm kiếm engine usesits own proprietary algorithm to lớn create the indices in such a way that ideally,only meaningful results are returned for each query.

Sincealmost every trang web owners rely on the fact that the tìm kiếm engines will sendtraffic lớn their trang web & also the entire industry has grown around the conceptof optimizing Web nội dung in order lớn improve sầu their placement in the searchengine results, we should acquire adequate knowledge about search engineoptimization or SEO.

Characteristics of Search Engine

Unedited – Search engines are unedited.Anyone can enter the search nội dung.Some tìm kiếm engines come up with inbuilt chất lượng issues;Search engines can mark the websites as Spam if the websites uses sometricks in order to lớn be on the top of the SERP.Search engines comes up with an array of information types e.g. Phonebook, brochures, catalogs, dissertations, news reports,weather, all in one place!Search engines have sầu the ability lớn cater the needs of different kinds ofusers.

Xem thêm: Tải Game Danh Bai Doi Thuong Su500 Online Cho Android, Tien Len Mien Nam

Tips khổng lồ be followed while Using Search Engines

We mustensure khổng lồ be called as one of the best website searcher that whatever we need lớn typein order lớn tell the search engine should be exactly what we are looking for. Thesearch operators fall inlớn two broad categories –

Boolean operators andNon-Boolean operators

Anoperator is a word or symbol which we type. It provides the search engine the directionshelp it knows what to lớn search for. Using these operators we can either narrow orbroaden our search, thus helping us to lớn locate the website sites which may be usefullớn you.

We needto check out the individual tìm kiếm engines lớn find out which operators it isbased upon.

BooleanSearching Techniques:

AND- This means the tìm kiếm results must have both the words. Very often it istyped in UPPER CASE, but is not mandatory. This reduces the count of thewebsites. Thus narrowing in on specific topics.e.g. air AND water AND pollution will tìm kiếm for the website sites which contain all the three từ khoá - air, water& pollutionOR- This means that the tìm kiếm results may have either of the terms that isentered. This increases the number of web sites which will be looked upon, thusbroadening our tìm kiếm. E.g. air OR pollutionOR water will look for the website sites that contains either air or pollution orwater.NOT- This means any result containing the second keywords or the token will beexcluded from the tìm kiếm result. Using NOT decreases the number of sites thatwill be listed as a result of our tìm kiếm. Thus it narrows our search. e.g. ifwe enter the tokens - air NOT pollution, the results will danh sách out the websitesthat contain air but not pollution.

We should be very careful about whileNOT because if a website mentions pollution even once, it may be excluded fromthe tìm kiếm result. This could lead khổng lồ exclusion of some important website sites. Similarlywe should be careful while using OR. as this may kết thúc up with a huge number ofsites which require sort through.

Non-Boolean Searching Techniques:

+This works in the same way the AND works. This makes the token mandatorily requiredin the tìm kiếm results. The symbol + should be placed directly in front of thetìm kiếm token và should not have sầu any spaces. e.g. air+water+pollution will lookfor all the web sites that contain these three tokens - air, water and pollution.–This works in the same way the NOT works. This is meant khổng lồ exclude the tokenwhich follows the symbol -. e.g air - pollutionwill các mục out all the websites that contain air but not pollution.“” This symbols is placed around the tokens to indicate that the tìm kiếm enginewill look for the exact phrase. e.g. “air water pollution” will look for thatexact phrase. This will make your search very specific.

Similar to the Boolean terms, wemust be careful while using – as this can eliminate the website sites that mightmention the term which we vày not want, but are not really about that term. –

Water will eliminate all the websites that are about air pollution but talk about water pollution as well.

Creating our own tìm kiếm engines

Beingtired of using the generic search engines e.g. Google & Yahoo every time, wewish khổng lồ look out for anything. Best idea would be to try and build our ownSearch Engine using the open source technologies like PHPhường và MySQL. Let memake it clear that our goal is not khổng lồ throw the big giants e.g. Google, Yahoo,Bing etc out of the market, but we can give a good attempt to lớn have sầu our owntìm kiếm engine.

In thisapproach we will learn lớn build our own search engine và eventually we would seethe visitors coming and doing a search on our trang web in mass with the help obạn Html tìm kiếm size, having the standard button. Here we will use the phplanguage and MySql database services in order khổng lồ implement this feature. Henceit is expected from the readers to lớn have sầu a good knowledge of the basic conceptsof both of these before go và start implementing. In this document, we will usethe most basic code & not go through the complex sql queries. Here, we can assumethat the basics of Structured query language or Squốc lộ is known khổng lồ everyone and youhave been using it in some form or other more often. So now let us focus on ourfirst HTML code which will help us to create a Search Button & khung which isgoing to be used by every visitor khổng lồ enter in any query.


As wehave mentioned that MySquốc lộ is one of the prerequisite in our approach, our firststep would be setup the MySQL database up và running. Connect lớn MySQL, we canany use any of the UI based không lấy phí tools e.g. Squirrel, HeidiSQL or DBVisualiseror the MySquốc lộ admin console. Once connected, let run the following Squốc lộ whichwill create a table called SEARCH_ENGINE.