Forum Moderators: coopster

Message Too Old, No Replies

PHP MySQL, Group By

         

XMLMania

7:05 pm on Jun 28, 2004 (gmt 0)

10+ Year Member



Hi,

I'm building an XML news feed search engine, using PHP and MySQL, and I am basing the style on Google.

I have achieved almost everything I have set out to do but... I would now like to incorporate the feature Google has were it shows 2 results from a website, and one is indented, and there's an additional link "More results from XYZ.com".

I've been fiddling around with GROUP BY, but, I would like to limit the group size to 2. Just like Google.

Is this possible?

coopster

7:10 pm on Jun 28, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are you aware of MySQL's LIMIT [dev.mysql.com] keyword?

ikbenhet1

7:22 pm on Jun 28, 2004 (gmt 0)

10+ Year Member




it is not possible to do it in 1 query, al least not that i know of.

i asked the same question once: [webmasterworld.com...]

you could also try it serverside, selecting more results and count the number of results per domain (you can use parse_url) and skipping after 2 urls per domain.

XMLMania

7:27 pm on Jun 28, 2004 (gmt 0)

10+ Year Member



I'm using the LIMIT function to sort by date or relevance dependent on user preference.

I've got a version of the search engine running by using what you describe ikbenhet1, but I'm not sure if it will stand 100s of users searching simultaneously.