Hashing tag list to perform faster search

by BAD_SEED   Last Updated September 14, 2018 14:05 PM

I have a list of items. Each item have various properties. Each item can be tagged, like tagging a post here. Right now, tags are represented using a Tags property, that is a string and it looks like tag1:tag2:...:tagN.

A user can search for an item based on its tags (i.e. get me items that has tag2 and tagN). To do this I need to scan the full items list and, even worst I need to split the Tags property and search if those tags are present.

What I'm searching for is a sort of hashing filter or a better algorithm to perform this type of search. Note that, if searching for tag2 would mean give me items with just tag2 the search would be simpler, alas what this really means is give me items that contains tag2, so splitting (at least, for now) is mandatory.

We would change the representation from tag1:tag2:...:tagN to a better one, in order to provide a faster search. Possibly without a lookup structure or something like that.



Related Questions





hashing algorithm to check inclusion in a set

Updated June 01, 2015 11:02 AM