0

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

user434509
  • 425
  • 8
  • 20

2 Answers2

0

I don't know why it's a faceted search but here is an example with php and mysql using joins: Faceted Search (solr) vs Good old filtering via PHP?.

Community
  • 1
  • 1
Micromega
  • 12,486
  • 7
  • 35
  • 72
  • Actually I am able filter the data with database queries in some functions. I am having problem with many GET methods in url while calling these functions. – user434509 Aug 10 '12 at 17:53
0

Here's a tutorial on faceted search in Sphinx / Manticore Search - https://play.manticoresearch.com/faceting/

Manticore Search
  • 1,462
  • 9
  • 9