Click here to Skip to main content
16,004,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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... :)
Posted

1 solution

The genres and book features are not mutually exclusive. So, make some attributes in the form of a bitset. Something like that:
C#
 enum BookFeatureClassifiers {
    Horror = 1 << 1,  // 1
    Fantasy = 1 << 2, // 2
    Sex = 1 << 3,     // 4
    History = 1 << 4, // 8
    //...
}


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
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900