06-04-2010, 03:03 AM
|
#3 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
Quote:
Originally Posted by CΛSTΞX
For example, if the search is
Norton free 2010 Download
How to order results like this
Norton free download
Norton download
Norton 2010 for pc
The first one includes 3 words of the search, so it is first. How to do this, thanks...
|
If I understand this correctly, you want to order by the number of words that are the same THEN the percentage of words the same. Here is another result set:
Search "Google SEO Tips"
1. Google SEO Tips
2. Google SEO Tips blog
3. Google search Tips
3. Google search Tips blog
If so there is no easy way. The query would require custom functions to be defined using stored procedures. If you want to hire me I will be willing to do this, but here is the best I can/will do for free:
This will give you the occurrences of a string in another string (we are finding the number of occurrences of stringB in stringA).
mysql Code:
set @stringA="Google Search Google", @stringB="Google";
SELECT ((LENGTH(@stringA) - LENGTH(REPLACE(@stringA,@stringB, '')))/LENGTH(@stringB)) AS `occurrences`
It will return 2.
|
|
|
|