chandler Posted November 14, 2009 Share Posted November 14, 2009 Hi hope you smart people can help with this problem. The search engine is for a product search website, its default preference is to search by most relevant. This then will display the product like so Product Title Price Description Image links>> full description | sellers name << This is the problem The problem we have with this is, if we search for a product for example jeans and if one of the sellers is selling more than one type of jeans and in some cases they are selling up to 30 so the result we then have is one seller taking up the 1st 3 pages of the search result (max 10 products on each page), then on the 4th page we are able to see products from the next seller and that list may also go on for 2 or 3 pages. We have tried The rand() function but then this messes up the relevancy of the search result. So what we need is same way to randomize the seller name string while keeping the of the result relevancy. Many thanks for you help with this. Quote Link to comment https://forums.phpfreaks.com/topic/181473-php-search-engine-problem/ Share on other sites More sharing options...
ngreenwood6 Posted November 14, 2009 Share Posted November 14, 2009 If I have read your post correctly you would only want the seller/or the product to show up once. Either way this solution should work for you. When you make your query use the DISTINCT keyword. For example: SELECT DISTINCT name FROM table Quote Link to comment https://forums.phpfreaks.com/topic/181473-php-search-engine-problem/#findComment-957287 Share on other sites More sharing options...
chandler Posted November 14, 2009 Author Share Posted November 14, 2009 I will give an Example: if we search mp3 player and we have 50 mp3 products from apple and 50 from Creative ZEN in our database, the result will then display the most relevant from one of these sellers lets say apple followed by the other 49 in a relevant order all from apple then the 51st product will be from Creative ZEN followed by the other 49 from Creative ZEN. Of course to make the site fair for the seller we cant have one sellers product taking up the 1st 3 to 5 pages of the result. so instead of the current result of: apple apple apple apple apple x50 then Creative ZEN Creative ZEN Creative ZEN Creative ZEN x50 this is how we want the result: apple Creative ZEN apple Creative ZEN apple Creative ZEN But of course keeping in the order of most relevant. Quote Link to comment https://forums.phpfreaks.com/topic/181473-php-search-engine-problem/#findComment-957312 Share on other sites More sharing options...
chandler Posted November 14, 2009 Author Share Posted November 14, 2009 bump Quote Link to comment https://forums.phpfreaks.com/topic/181473-php-search-engine-problem/#findComment-957513 Share on other sites More sharing options...
chandler Posted November 15, 2009 Author Share Posted November 15, 2009 bump Quote Link to comment https://forums.phpfreaks.com/topic/181473-php-search-engine-problem/#findComment-957945 Share on other sites More sharing options...
chandler Posted November 15, 2009 Author Share Posted November 15, 2009 bump Quote Link to comment https://forums.phpfreaks.com/topic/181473-php-search-engine-problem/#findComment-958042 Share on other sites More sharing options...
JustLikeIcarus Posted November 16, 2009 Share Posted November 16, 2009 Ok so it just seems that your ordering the results by both name and revelance which is the incorrect method of producing a list like this. Would it be possible for you to post the php and sql your using for this? Im willing to help if I can. Quote Link to comment https://forums.phpfreaks.com/topic/181473-php-search-engine-problem/#findComment-958603 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.