Search for PHP word segmentation by matching quantity. First, the word segmentation function is completed.
For example, if you search for "advanced PHP Tutorial", you can extract "advanced PHP Tutorial"
Now we need to sort by matching quantity. At the same time, the content of all words is ranked first, and the content of two words is ranked second. only one word is ranked last.
How can this function be implemented?
Reply to discussion (solution)
If full-text search is not used, your requirements can be met, but the efficiency is extremely low (joint query)
However, mysql full-text search does not support Chinese characters, so you need to install third-party software.
Third-party software installation usually requires some cost.
Another solution is to store the text after word segmentation into the database in hexadecimal format.
However, this requires at least one more storage space.
Choose Your Own
If full-text search is not used, your requirements can be met, but the efficiency is extremely low (joint query)
However, mysql full-text search does not support Chinese characters, so you need to install third-party software.
Third-party software installation usually requires some cost.
Another solution is to store the text after word segmentation into the database in hexadecimal format.
However, this requires at least one more storage space.
Choose Your Own
Maybe I have not made it clear.
For example, the title of three articles is as follows:
1. download the tutorial
2. download advanced PHP tutorials
3. PHP Tutorial download
I used keywords to search: "advanced PHP Tutorial". the titles of all three articles should be available,
Sort as follows:
1. Download "match to three keywords" in the advanced PHP Tutorial
2. download matching two keywords in the PHP Tutorial
3. Download "match to a keyword" in the tutorial.
Realistic ideas and methods
No where? It does not seem to work, but thanks for the version.
Oh, where is missing
Make it up by yourself. it is meaningless.
You should use full-text indexes in this case.
Coreseek + sphek
Reference: http://www.cnblogs.com/yjf512/p/3581869.html
It seems that word segmentation search is really a pitfall.
I sincerely thank the two moderators for their enthusiastic answers.
Have you solved this problem? I want to solve it now.