What data types are typically used for tag based searching? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What data types are typically used for tag based searching?

Looking at websites like YouTube, google, twitter, discord, and even this SoloLearn QnA section, most content is searched and or sorted by tags. It’s made me curious if there is a specific datatype built for searching through items with tags efficiently. My question is, what is most commonly used for tag searching with large sums of data? And does it vary by language? I assume it’s not just a simple loop through every single thing the website has since that would be ridiculous and absurd for the billions of things those websites search through.

25th Feb 2020, 6:19 PM
Pie
Pie - avatar
5 Answers
+ 3
Your qustion is related Sop (Search engain optimisation) Every website have there own algorithem for filtering result.
25th Feb 2020, 6:34 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
+ 3
In addition to storing which tags a document has, you also want to store which documents have any given tag. This is called reverse indexing. For example, say you have your usual datastructure (sql/nosql database, textfile, etc) containing blog posts: Blog Post 1: #foo, #bar Blog Post 2: #bar Blog Post 3: #foo, #qux You'd want to add an inverted index table containing tags, and respective blog post ids: #foo: 1, 3 #bar: 2 #qux: 3 This allows for fast lookup. If you are using say an sql database then it will of course do more black magic to make searching your reverse index fast. If you want to get your hands even dirtier you could try implementing a "Trie" by hand, which allows for fast lookup in a big list of strings (your leaf nodes would still be document ids). Although you probably can't outperform an sql database.
25th Feb 2020, 10:28 PM
Schindlabua
Schindlabua - avatar
+ 2
Sumit Programmer😎😎 after doing a small bit of research it seems the most common explanations of SOP are about how to make your website more viewable or how to use it for buissness. I haven’t found much on how to create one.
25th Feb 2020, 7:11 PM
Pie
Pie - avatar
+ 2
Its depand on you how you want to filter your list. For example : if you want to filter your resturant list using there rating than you have to creat algo in such way that filter your resturant your list by resturant rating
25th Feb 2020, 7:21 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
+ 2
Pie these large websites typically store their data in a database. Whether it is a relational data model (SQL) or key/value store (NOSQL), there are ways to use a query language to filter millions or billions of records very quickly. Databases use indexes that make searching in data very efficient.
25th Feb 2020, 8:08 PM
Tibor Santa
Tibor Santa - avatar