开发者

android tags best practices and sqlite storing and select

开发者 https://www.devze.com 2023-03-14 19:04 出处:网络
What are the best data structure for tags (not nfc or html). Like tags that are used in stackoverflow to mark our messages.

What are the best data structure for tags (not nfc or html). Like tags that are used in stackoverflow to mark our messages. I was thinking of List < String > ?

Then i need to store this tags into database and then select them for search. (Create separate table for tags?)开发者_开发百科

Please share your knowledge and/or examples.

Thank you.


If you just want to store a list of tags i.e. List<String>, I think simple File based storage would not be a bad option too. You can read data from file and populate a List<String> then use this List<String> in your application. If by search you mean only to check whether a tag exists or not File based approach will work in this case too. You can once populate the list and do query operations on the list.

But if you have to store some other data too with respect to these tags, like Posts in stackoverflow which are associated with tags, and you need to performs relational searches like which tags are associated with which post then it makes sense to store these tags in a separate table in SQLite database. In this way you can also refer tags column as foreign key from some other table which also need tags related information. It will make search easier for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消