PHP implements tag matching data and sorts the data by tag matching weight


The business requirements are as follows:
A user should fill in three categories, and select up to five labels under each category, as follows:
Label selected by user a:
Amount: 2-3 million, 3-5 million, 5-10 million (up to 5)
Round: angel round, Round A, Round B, Duel-Wheel (up to 5)
Industry: Finance, Internet, Medical, Science and Technology (up to 5)

There are tens of thousands of items of data, each with its own label, as follows:
Label to which item 1 belongs:
Amount: 2-3 million (single choice)
Round: angel round (single choice)
Industry: Internet, Science and Technology, Logistics (up to 5)

Label to which item 2 belongs:
Amount: 10-15 million (single choice)
Round: Round C (single choice)
Industry: Technology, Internet (up to 5)

(thousands of data)

Label weight:

id name score
1 100万-200万 0.6
2 200万-300万 0.8
3 300万-500万 0.5
4 500万-1000万 0.3
5 1000万-1500万 0.7
6 1500万-2000万 0.6
7 2000万-5000万 0.2

Number of rounds:

id name score
1 种子轮 0.4
2 天使轮 0.7
3 A轮 0.8
4 pre-A轮 0.1
5 B轮 0.5
6 C轮 0.2
7 D轮 0.2


id name score
1 互联网 0.9
2 医药 0.4
3 科技 0.6
4 物联网 0.6
5 物流 0.7
6 制造 0.3
7 餐饮 0.5

Now, it is necessary to match the corresponding items to user a according to his tags (as long as the items contain any tag of all the classification tags selected by a, the matching items will be sorted from top to bottom according to the tag matching weight

For example, the matching weights of items 1 and A are:
0.8 (2-3 million) plus 0.7 (angel round) plus 0.9 (Internet) plus 0.6 (Technology) =3

How to realize such requirements (the project is based on the laravel framework)? ?

Mysql cannot be implemented in the first place. All possible matching orders can be cached according to the weighted formula technology. The problem lies in the output of the update operation. laravel can use its own queue in combination with redis’ subscription and publishing mechanism.

=。 = We are similar to the project in Meituan-Dianping. When doing multi-criteria screening for merchants, one condition is that it cannot be cached from this, and we still use tp5
Brother, can you tell me how you are doing in this area?