<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The site I'm working on needs to display images that area searchable by<br>

using keywords (for example something like Cats AND Dogs...). Do you have<br>
any suggestions or know how one can do so in erlang? For example, lets say<br>
before uploading the image I attach a bunch of key words to it, lets say in<br>
the following manner<br>
{[Keyword1...Keywordn],Image}</blockquote></div><br>Like Christian said, you need an inverted index, where each keywords points to a list of image ids. How you do it really depends on the number of keywords and images you are dealing with. Here's two suggestions.<br>
<br>1) Simple set table with tuples like<br>{keyword, [image_id]}<br><br>2) Ordered set table with tuples like<br>{{keyword, image_id}, value}<br><br>The benefit of #2 is that every record is very small so it can work with a large number of image_ids, and since the table is an ordered_set, you can quickly get all the image_ids for a single keyword. The extra value can be whatever you want: metadata, score/importance, whatever.<br>
<br>Once you have a list for each keyword, you can do a set intersection.<br><br>Here's some wikipedia articles with deeper info.<br><a href="http://en.wikipedia.org/wiki/Index_(search_engine)">http://en.wikipedia.org/wiki/Index_(search_engine)</a><br>
<a href="http://en.wikipedia.org/wiki/Information_retrieval">http://en.wikipedia.org/wiki/Information_retrieval</a><br><br>Jacob<br>