For example, how to design a subscription system depends on keywords, such as subscription & quot; Tips & quot; news titles include & quot; Tips & quot, subscribe to & quot; apple & quot; and then include the title of apple... in this case, some words may need to be designed and excluded. If the database LIKE is used, the resources will definitely consume a lot. I 'd LIKE to ask... for example, how to design a subscription system depends on key words, for example, subscribe to "S3." news headlines include "S3, subscribe to "apple", and get the title containing apple... this may also require the design to exclude certain words,
If you use the database LIKE, the resources will definitely consume a lot. Would you LIKE to ask how the mature practices are achieved? How do I publish different results to different subscribers?
Reply content:
For example, how to design a subscription system depends on key words, for example, subscribe to "S3." news headlines include "S3, subscribe to "apple", and get the title containing apple... this may also require the design to exclude certain words,
If you use the database LIKE, the resources will definitely consume a lot. Would you LIKE to ask how the mature practices are achieved? How do I publish different results to different subscribers?
Please give a detailed description of the problem.
Taking capturing information, news, and tens of millions of data records as an example, the data can be divided into the following parts:
1. the captured news will contain a classification module that tags each entry and then stores it into the database.
2. Maintain the data structure of a tag-unique news ID array in the memory for access speed. You can use redis or write a service separately.
3. There will be a table to maintain users and subscribe topics
4. when a user sends a request for obtaining a message, the user goes to the memory to obtain the latest news IDS Based on the Request's question, and then obtains the news and returns the news from the database based on the ID, add a cache to the database for anti-concurrency
If it is a search engine, an inverted index table is maintained in the memory. Every news item will clean the data and cut words into the table before it is written into the database, then, the user queries the keywords and returns several specific entries Based on the index in the table.
Above
Kafka system: publish and subscribe message system
ElasticSearch