- // Don't show images that fail the keyword test.
- if (g_hash_table_size(filter_kw_table) > 0)
- {
- gint match_count = 0;
- gint miss_count = 0;
- // TODO(xsdg): OPTIMIZATION Do the search inside of metadata.c to avoid a
- // bunch of string list copies.
- // TODO(xsdg): Allow user to switch between union and intersection.
- GList *img_keywords = metadata_read_list(fd, KEYWORD_KEY, METADATA_PLAIN);
- if (!img_keywords) continue;
-
- g_hash_table_iter_init(&filter_kw_iter, filter_kw_table);
- while (g_hash_table_iter_next(&filter_kw_iter, (void**)&filter_kw, NULL))
- {
- if (g_list_find_custom(img_keywords, filter_kw, (GCompareFunc)g_strcmp0))
- {
- ++match_count;
- }
- else
- {
- ++miss_count;
- }
- if (miss_count > 0) break;
- }
-
- string_list_free(img_keywords);
- if (miss_count > 0 || match_count == 0) continue;
- }
-