teach you to do keyword matching project (search engine)----17th day, teach you to do the 17th day _php Tutorial

Source: Internet
Author: User

teach you to do keyword matching project (search engine)----17th day, teach you to do 17th day


17th Day

Cameo: The deceptive form artifact of the cock silk

Starting point: teach you to do keyword matching project (search engine)----first day

Review: Hand-taught you to do keyword matching project (search engine)----16th Day

Small handsome to implement the blacklist entry task, he gave Xiaoding explained a half-day, xiaoding on the chin, looking at small handsome, do the expression of worship.

Small handsome feel hit, ran to the boss there complained: in the eldest, I told small Ding-Tintin, how to install database client, how to fill the blacklist, why to fill all said understand, small Tintin still do not understand, I really can't stand it.

Yullo to comfort small handsome said: "We do not hurry to implement this task, we first put the initial function to make, the whole shelf, input a baby can match the key words, the early words are sure a lot of keywords are not correct, but it does not matter, we come to teach."

Little handsome: ...

Yullo went on to say: As long as they see the results, it should be easy to understand, when they only worship you. Well, little handsome handsome happy point, a wall is normal, as long as in here to learn from the lesson is good.

Small handsome, although still a bit unhappy in the heart, but did not just start so angry. Small handsome answer: OK, I will continue to do function first, I first try to do the function of synonyms.

Examples of synonyms:

1. XXL, enlarge, enlarge yards
2. Jacket, clothing, clothing, outerwear, tops
3. Women, women, girls, females


Given that a particular category has a different definition of the synonyms for some of the words, the small handsome design the table structure like this:

CREATE TABLE ' category_linklist ' (   BIGINT(DEFAULTNULL' category ID  ',   VARCHAR(CHARACTER SET  DEFAULTNULL' class name '      ,VARCHAR(  255CHARACTERSETDEFAULTNULL' keyword, separated by commas ' ,      DATETIME DEFAULT NULL ' Entry Time ' , ) ENGINE=DEFAULT CHARSET=UTF8 COLLATE=Utf8_bi

Little handsome and added some data to it.

INSERT  into VALUES ("50010850", "Women's Clothing", "XXL, enlarged, enlarged yards"); INSERT  into VALUES ("50010850", "Women's clothing", "coats, garments, garments, coats, tops"); INSERT  into VALUES ("50010850", "Women's clothing", "Women, ladies, Girls, women");

Little Shuai has expanded a Charlisthandle class to deal with these synonyms specifically.

The code is as follows:

 PhpclassLinklistcharlisthandleextendsCharlisthandle { Public function exec(){        $sql= "Select Word from category_linklist where cid= '$this->selectoritem->cid ' "; $linklist= Db::makearray ($sql); foreach($linklist  as $strWords){            $words=Explode(",",$strWords); $properties=$this->selectoritem->getProperties (); foreach($properties  as $property){                $this->charlist->addcore ($property-value); if(In_array($property->value,$words)){                    foreach($words  as $char){                        $this->charlist->addcore ($char); }                }            }        }    }}

The small handsome also adds the Selectoritem to get an array of attributes:

classSelectoritem {#......     Public functiongetProperties () {$result=Array(); $properties=Explode(";",$this->item->props_name); foreach($properties  as $strProperty){            $result[] = Self::createitemproperty (Explode(":",$strProperty)); }       return $result; }     Public Static functionCreateitemproperty ($PROPERTYARR){        $property=NewStdClass (); $property->id =$PROPERTYARR[0]; $property->fieldid =$PROPERTYARR[1]; $property->name =$PROPERTYARR[2]; $property->value =$PROPERTYARR[3]; return $property; }   #......}

Selector's easy changes are as follows:

class Selector {    privatestatic$charListHandlearray(         "Blacklist" = "Backlistcharlisthandle",        "synonyms" = "Linklistcharlisthandle"    );     # ......}

When the small handsome this code to the eldest brother to see, in the boss just look at, put small handsome to batch.

Little handsome handsome is not the solution.

Predict why the little handsome handsome is approved, please see tell.




http://www.bkjia.com/PHPjc/869240.html www.bkjia.com true http://www.bkjia.com/PHPjc/869240.html techarticle Hand- taught you to do keyword matching project (search engine)----17th day, teach you to do the 17th day 17th day cameo: Cock Silk deceptive form artifact starting point: teach you to do the key ...

  • 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.