Teach you how to create a keyword matching Project (search engine) ---- 16th days, teach you how to do ---- _ PHP Tutorial

Source: Internet
Author: User
Teach you how to create a keyword matching Project (search engine) ---- 16th days, teach you to do ----. Teach you how to make a keyword match project (search engine) ---- 16th days, teach you to do ---- 16th days friendship guest: The hacker form of diaosi artifact starting point: teach you how to do keywords. teach you how to do keyword matching projects (search engines) ---- 16th days, teach you how to do ----

16th days

Friendship string: The hacker form artifact of diaosi

Start point: Teach you how to create a keyword matching Project (search engine) ---- day 1

Review: experts teach you how to perform keyword matching projects (search engines)-15th days

14 days pdf: http://files.cnblogs.com/oshine/%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E5%81%9A%E5%85%B3%E9%94% AE %E8%AF%8D%E5%8C%B9%E9%85%8D%E9%A1%B9%E7%9B% AE %2814%E5%A4%A9%29.pdf

Source code within 15 days:
Http://files.cnblogs.com/oshine/myproject.rar

From the last time Mr. Shuai discussed with Mr. Yu, there was a very depressing thing that was not fixed yet, that is, what is the data format of our existing correspondence, antonyms, and synonyms?

Shuai had to understand this before he could continue, so he went to consult the boss again.

The boss told Shuai that we should not consider so many factors first. let's start from the reality first. let's do the antonym first. let's start from women's clothing first. women's clothing is a category, we start with category.

The fields in the table structure have categories and antonyms.

Shuai created the table:

Create table 'Category _ backlist' ('CID' BIGINT (20) default null comment 'Category ID', 'catmatch' VARCHAR (50) character set utf8 default null comment 'Category name', 'word' VARCHAR (18) character set utf8 default null comment' keyword ', 'created 'datetime default null comment' input time ', unique key 'CID' ('CID', 'keyword') ENGINE = innodb default charset = utf8 COLLATE = utf8_bin

Shuai and completed the data.

Insert into category_backlist (cid, catmatch, word) VALUES ("50010850", "women's wear", "male"); insert into category_backlist (cid, catmatch, word) VALUES ("50010850", "women's wear", "children"); insert into category_backlist (cid, catmatch, word) VALUES ("50010850", "women's wear", "Baby "); #......

Shuai easily corrected the code.

 Charlist = $ charlist; $ this-> selectorItem = $ selectorItem;} abstract function exec ();} class BacklistCharListHandle extends CharListHandle {public function exec () {$ SQL = "select word from category_backlist where cid = '$ this-> selectorItem-> cid'"; $ backlist = DB: makeArray ($ SQL ); foreach ($ backlist as $ char) {$ this-> charlist-> addBlacklist ($ char );}}} class Selector {private static $ charListHandle = array ("blacklist" => "BacklistCharListHandle"); public static function select ($ num_iid) {$ selectorItem = SelectorItem :: createFromApi ($ num_iid); Logger: trace ($ selectorItem-> props_name); $ charlist = new CharList (); foreach (self :: $ charListHandle as $ matchKey => $ className) {$ handle = self: createCharListHandle ($ className, $ charlist, $ selectorItem); $ handle-> exec ();} // do search things var_dump ($ charlist);} public static function createCharListHandle ($ className, $ charlist, $ selectorItem) {if (class_exists ($ className )) {return new $ className ($ charlist, $ selectorItem);} throw new Exception ("class not exists", 0 );}}

This is not the original version of Shuai. his original version:

CharListHandle has two attributes: charlist and cid.

After reading this, the boss needs to replace cid with selectorItem. The reason is that he wants to think about it.


Shuai also wrote a DB operation class. the code is as follows:

 

When Shuai gave the code to the boss, he was very happy.

According to boss Yu, no matter how you add or delete the changes to our blacklist, the normal operation of the system will not be affected, and we can work well with our business, for this blacklist task, you think it is more appropriate to teach.

Mr. Shuai was very happy to hear that he could transfer the task. I think the product or operation department is suitable for doing these things.

Mr. Yu patted Mr. Shuai on the shoulder and said, "You have to implement this.

Occasional separation of duties is not necessarily a lazy action. In general, it is to make the entire service more professional and efficient.

Shuai was forced to implement the task of the boss.




Tips (search engine) ---- 16th days, teach you to do ---- 16th days friendship guest: diaosi pitfall form artifact starting point: teach you to do keywords...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.