如何分类上载的文档以及如何存储文档名称(无论是散列还是纯文本)... [英] how to classify the uploaded document's and how o store the document name whether hashed or plain...

查看:65
本文介绍了如何分类上载的文档以及如何存储文档名称(无论是散列还是纯文本)...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!我需要添加在我的网站中上传文档的功能,但问题是.
我应该如何对这些文件进行分类或分离...即它们是否是恐怖书,喜剧等....

我已经为这些文档创建了单独的表,因此,一旦这些文档被分类,它们的数据就会存储到d/b中.
而且,我应该如何在d/b中存储文档名称,即.我应该对它们进行散列还是将名称保留为纯文本...哪一种会更有效,这将有助于搜索doc.if散列,那么我应该如何实现它....

有人可以指导我解决上述问题吗...我以前从未做过这些事情..

预先感谢...:)

hi!! i need to add feature of uploading documents in my website but the problem is.
how should i classify or separate those documents... ie.whether they are horror book,comedy book etc....

i have created separate tables for these doc''s so, as soon as those doc''s are classified their data would be stored into d/b......

and also,how should i store the name of doc''s in d/b ie. should i hash them or keep the name in plain text... which one would be more efficient which would help in searching the doc.if hashing then how should i implement it....

can someone please guide me with the above issues... i have never done these thing''s before..

Thank''s in advance... :)

推荐答案

类型和书籍功能不是互相排斥的.因此,以 bitset 的形式设置一些属性.像这样的东西:
The genres and book features are not mutually exclusive. So, make some attributes in the form of a bitset. Something like that:
 enum BookFeatureClassifiers {
    Horror = 1 << 1,  // 1
    Fantasy = 1 << 2, // 2
    Sex = 1 << 3,     // 4
    History = 1 << 4, // 8
    //...
}



使用按位或运算将元素(以枚举成员之一的形式)添加到集合中. (您未指定语言,因此可能是"And"或"|").要检查是否设置了某个位,请使用按位与运算并将结果与​​0比较(这意味着该位是清除的,否则进行设置).

要将其存储在数据库中,请将枚举值转换为足够大小的整数.

—SA



Use bitwise OR operation to add an element (in the form of one of the enumeration members) to a set. (You did not indicate your language, so it could be ''And'' or ''|''). To check up if a bit is set, use bitwise AND operation and compare the result with 0 (which means that the bit is clear, set otherwise).

To store it in a database, cast the enumeration value to an integer numeric value of sufficient size.

—SA


这篇关于如何分类上载的文档以及如何存储文档名称(无论是散列还是纯文本)...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆