381
/* Run through @filter_set and remove any row from the result set's model
382
* in which URI is not in @valid_uris */
383
public void apply_uri_filter (Set<string> valid_uris,
384
Dee.ResultSet filter_set)
386
var model = filter_set.get_model ();
390
/* Anything in filter_set that is not in the event_uris set, is removed
391
* from the results_model */
392
foreach (var row in filter_set)
381
/* Extract a hash set of all subject uris in a Zeitgeist.ResultSet */
382
public Set<string> get_uri_set (Zeitgeist.ResultSet results)
394
uri = model.get_string (row, ResultsColumn.URI);
395
if (!(uri in valid_uris))
384
Set<string> uris = new HashSet<string> ();
386
foreach (var ev in results)
399
//debug (" - %s", uri);
388
for (int i = 0; i < ev.num_subjects(); i++)
389
uris.add (ev.get_subject (i).get_uri ());
404
debug ("Removed %u rows from result set", n_removed);
407
/* Returns true iff new_search is a query that simply restricts the
408
* result set of old_query */
409
public bool check_is_filter_search (LensSearch new_search, LensSearch? old_search)
411
bool is_filter_search = false;
412
if (old_search != null)
414
string previous_search_string = old_search.search_string;
415
if (previous_search_string != null && previous_search_string != "")
416
is_filter_search = new_search.search_string.has_prefix (
417
previous_search_string);
420
return is_filter_search;
423
/* Extract a hash set of all subject uris in a Zeitgeist.ResultSet */
424
public Set<string> get_uri_set (Zeitgeist.ResultSet results)
426
Set<string> uris = new HashSet<string> ();
428
foreach (var ev in results)
430
for (int i = 0; i < ev.num_subjects(); i++)
431
uris.add (ev.get_subject (i).get_uri ());
437
public string normalize_string (string input)
439
return input.normalize (-1, NormalizeMode.ALL_COMPOSE).casefold ();
395
public string normalize_string (string input)
397
return input.normalize (-1, NormalizeMode.ALL_COMPOSE).casefold ();
442
400
} /* namespace */