Like Zhongguancun online, or how the Pacific Auto Multi-attribute search is done, how the idea

Source: Internet
Author: User
Tags acer
This post was last edited by airukongqi4321 on 2013-11-03 11:44:21

Multi-Attribute Search

http://detail.zol.com.cn/notebook_index/subcate16_0_list_4000_s1227_1_1_0_1.html Zhongguancun Online
http://price.pcauto.com.cn/price/q-p2-k75.html Pacific Motor

By clicking on an attribute, some properties of the product will be dimmed and unavailable
The feeling asks how to realize this kind of function is how the idea, how to do ...
The score is not many excuse me, hehe ....


Reply to discussion (solution)

Someone asked this before.
Two scenarios:
1 is the use of JavaScript based on the selected variable combination into a URL, this scheme needs to select First, click on a button to open the Web page (operation is a bit like commit)
2 is PHP according to each parameter to write a link, this scheme to refresh the page every time you click on a parameter, refresh the page will refer to the selected conditions of the various links to recalculate the output

The 2 transformation scheme is AJAX

View-source:http://detail.zol.com.cn/notebook_index/subcate16_0_list_4000_s1227_1_1_0_1.html

 
  
  
Brand
Not Limited Lenovo Asus Dell HP Shenzhou acer acer?.....
Price
Not limited to 1999 yuan or less 2000-2499 yuan 2500-2999 yuan
Obviously, the connection is generated by the server.

View-source:http://price.pcauto.com.cn/price/q-p2-k75.html
Price: Unlimited 50,000 or less 580,000 8.1 million 10.15 million 15.2 million 20.25 million ... Level: not limited to mini-car compact car medium-sized car mid-size car

The same is true

Common ideas or background integration in the URL output to the foreground bar.

Ajiax Background processing data

The simplest way Ajax gets data output

In fact, the crux of the problem is: "How to determine the existence of other attributes through a single attribute of a Thing";

If the condition is every point, will go to the database to take it, it is not difficult to achieve, such as a point

"580,000" This condition, the most stupid way is just in the background
SELECT * from Auto_detail where Market_price >= 50000 and Market_price < 80000;
(Suppose Auto_detail is a detailed table of all models that store all the vendors)

The returned result may have hundreds of, and then loop over the result, and each will return the set of Auto_grade,car_brand .... (slightly); All in a two-dimensional array.

That "all car grade, car brand. "Wait, what about the data?" Nothing more than select distinct auto_grade from XXX only.
Do a good job of all this contrast, do not have to constantly update the data put in the cache, you do not have to go to the database every time.

Then it is simple, to judge separately, Auto_grade those attributes are there, those attributes are not, and then return an array to jquery, control the page to change the style.

That's the dumbest thing to do, right?

This is a dedicated enterprise-class search engine!

Check out SOLR, Sphix and lucene!.

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