简体   繁体   中英

Algorithm to select pet breed / cars / bikes / etc from database based on user answers

This quesiton is more about getting a point in the right direction. I inherited and developed upon a project to create a car selection database (matching user preferences). It is already working relatively well but could be better (there are a few issues), so I'd like to study some other algorithms used by others. The site I'm working on uses a best match algorithm where each car is assigned a "1" each time it matches a quesiton answered and these are added up.

I like in particular, the following site (to select dog breeds):

http://animal.discovery.com/breed-selector/dog-breeds.html

Can anyone point me in the right direction as to where I might find something similar (I've been looking, but probably not looking in the right places or using the right search terms)? I'd like to be able to view and study the algorithm used (PHP/mySQL).

The (incomplete) site I'm working on:

http://www.myperfectcar.com.ph/

Any help would be much appreciated. Thanks.

It is exactly as any other filter with dropdowns, except that it is implemented in wizard-like form. You need to have some class, in session with more-less such structure:

public class CarSearchWizard
{
    public int Passengiers = 0;
    public int DrivingFor = 0;
    ...
}

I didn't notice that your search depends on previous selection, so it is rather simple - filter for number of people, driving etc on each iteration of user search. I think your algorythm is ok, except it is rather long to fulfill :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM