I am trying to build a faceted search for a PHP based e-commerce website. Building filters using GET
methods is making code very complicated as the website has many filters. Can someone give some tutorial or some better way for building a faceted search?
I thought of implementing faceted search using Sphinx, but I am new to Sphinx. The client has rejected Sphinx (I don't know why). I am able to build basic search using Sphinx, but don't know how to go ahead with faceted search. If someone can provide some tutorials on Sphinx that will be great as I may try to convince the client after implementing using it. Time is a major factor here as I have to implement faceted search in a day.
$urlstring = '';
$urlstring = rmParamQS('category');
$urlstring = rmParamQS('brand', $urlstring);
code that will add the new query string like category or brand and will remove existing query strings from above functions
$url = 'http://' . $_SERVER['SERVER_NAME'].'?page='.$page.$urlstring;
$categoryGet = (isset($_GET['category']))?$_GET['category']:NULL;
$categoryQS = '&category='.$categoryGet;
$brandGet = (isset($_GET['brand']))?$_GET['brand']:NULL;
$brandQS = '&brand='.$brandGet;
$categories = categories_list($brandGet);
echo '<ul id="categories">';
list all categories using foreach with link in following format
echo '<a href="'.$url.'&category='.$category["category_id"].'">'
echo '</ul>';
$brands = brands_list($categoryGet);
echo '<ul id="brands">';
list all brands using foreach with link in following format
echo '<a href="'.$url.'&brand='.$brand["brand_id"].'">'
echo '</ul>';
Like categories and brands I have five more filters. The rmParamQS function will remove the respective query string from $url. the categories_list and brands_list functions will filter data based on ids in Query Strings in url of other filters