Java Open source Fresh e-commerce platform-search module design and architecture (source code can be downloaded)

Source: Internet
Author: User

Java Open source Fresh e-commerce platform-search module design and architecture (source code can be downloaded)

Description: The search module is aimed at the buyer's users, looking for food products to find a very strenuous query. Currently, it is also a fast search product.

For mobile app buyer users, the required speed is completed in 3 seconds. Support fuzzy query, due to business combat surface, the entire search frequency less than 18%-25%

At the same time the business is not very big, so did not adopt the Java full-text retrieval technology. (Lucene, etc.). The basic fuzzy query is used here.

1. Searching for dimensions is thinking.

1.1 The content of the buyer's search is likely to be for the property of the dish itself, so it involves the product name, the product alias, the commodity label, the product description, the specification name, the processing method and so on.

1.2 We know that fuzzy search results in index invalidation, while the entire query performance is also affected.

1.3 Business Patterns show that the words and content of some hot spots can be cached by the JVM to increase the overall purchase rate of a single item. For example potatoes now analyze a lot of people want, if we can talk to a business, one day

Need 10w pounds of potatoes to supply the amount, then the entire page will appear the default display of this keyword. This is a back-end flexible configuration.

2. For buyers search keywords, we need a database to record, so that the system level can be calculated from the buyer will need, can be targeted marketing.

The related database tables are designed as follows:

CREATE TABLE ' buyer_search ' (  ' id ' bigint () unsigned not NULL auto_increment COMMENT ' auto increment id ',  ' buyer_id ' bigint () default NULL COMMENT ' buyer ID ',  ' words ' bigint (default null COMMENT ' seller ID ', c7/>' Create Time ',  PRIMARY KEY (' id ')) ENGINE=innodb DEFAULT charset=utf8 comment= ' buyer search record form ';

Note: The purpose is actually very clear, is to record the buyer search keywords for analysis and research purposes. In order to better experience the user.

The relevant business code is as follows:

    /*** New app Full Text search *@paramRequest *@paramResponse *@paramkeyword *@return     */@RequestMapping (Value= "/search/new", method ={requestmethod.get, requestmethod.post}) PublicJsonresult Newsearchgoods (httpservletrequest request, HttpServletResponse Response,long Userid,long regionId, String keyword) {Try{logger.info ("SearchController.search.keyword: Search content:" +keyword); //search Results by merchant display//list<sellervo> List = Sellerservice.searchseller (Regionid,keyword); //search results displayed by Productlist<newsearchvo> list =goodsservice.newsearchgoods (Userid,regionid,keyword); return NewJsonresult (jsonresultcode.success, "Query information succeeded", list); }Catch(Exception ex) {Logger.error ("[Searchcontroller][newsearchgoods] Exception:", ex); return NewJsonresult (jsonresultcode.failure, "system error, please retry later", "" "); }    }    

The VO objects are as follows:

/*** Search Display Class (App global Search)*/ Public classNewsearchvoImplementsserializable{Private Static Final LongSerialversionuid = 1L; /*** The ID from users*/    PrivateLong Sellerid; /*** Shop Name*/    PrivateString Sellername; /*** Shop alias, can be understood as the abbreviation*/    PrivateString Selleralias; /*** Shop Logo*/    PrivateString Sellerlogo; /*** Store rating, default is 0*/    Private intSellerrank; /*** Store Rating*/    PrivateDouble Sellergrade; /*** Product List after search*/    PrivateList<goodsvo>searchitemlist;  PublicLong Getsellerid () {returnSellerid; }     Public voidSetsellerid (Long sellerid) { This. Sellerid =Sellerid; }     PublicString Getsellername () {returnSellername; }     Public voidsetsellername (String sellername) { This. Sellername =Sellername; }     PublicString Getselleralias () {returnSelleralias; }     Public voidSetselleralias (String selleralias) { This. Selleralias =Selleralias; }     PublicString Getsellerlogo () {returnSellerlogo; }     Public voidSetsellerlogo (String sellerlogo) { This. Sellerlogo =Sellerlogo; }     Public intGetsellerrank () {returnSellerrank; }     Public voidSetsellerrank (intSellerrank) {         This. Sellerrank =Sellerrank; }     PublicDouble Getsellergrade () {returnSellergrade; }     Public voidSetsellergrade (Double sellergrade) { This. Sellergrade =Sellergrade; }     PublicList<goodsvo>getsearchitemlist () {returnsearchitemlist; }     Public voidSetsearchitemlist (list<goodsvo>searchitemlist) {         This. searchitemlist =searchitemlist; }}

3, the data query performance of the basic requirements of the temporary, also posted out for everyone to reference together, the purpose is to study and think together.

<!--global Search Products New--<select id= "Newsearchgoods" resultmap= "Newsearchresult" > <include refid= "Newsea Rchselect "/> <include refid=" Newsearchfrom "/> <include refid=" Searchwhere "/> <iftest= "Keyword! = null" >and (G.goods_name like concat ('% ', #{keyword}, '% ') or g.goods_as like Concat ('% ', #{keyword}, '% ') or G.goods_label like Concat ('% ', #{keyword}, '% ') or G.goods_brand like Concat ('% ', #{keyword}, '% ') or G.goods_desc like Concat ('% ', #{keyword}, '% ') or gf.format_name like Concat ('% ', #{keyword}, '% ') or pm.method_name like Concat ('% ', #{keyword}, '% ') or s.seller_name like Concat ('% ', #{keyword}, '% ') or exists (select1 from category where category_id = g.category_id and category_name like concat ('% ', #{keyword}, '% ') )            )         </if> <include refid= "Searchorderby"/> </select>

Summary, because the search this piece of business involved relatively little, function is relatively single, the gold content is not very high, so learn from each other.

For the expansion scheme, if this piece of business discovery is large, you can use Chinese word segmentation records, data mining, has been cold hot spot data separation and so on, this late we need, we re-study.

Related business operations are as follows:

Java Open source Fresh e-commerce platform-search module design and architecture (source code can be downloaded), if you need to download, you can download under my github.

Java Open source Fresh e-commerce platform-search module design and architecture (source code can be downloaded)

Related Article

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.