mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-16 08:18:51 +00:00
test for querying non-fixed-size tags (#t)
This commit is contained in:
@ -102,6 +102,19 @@ sub doesMatchSingle {
|
||||
return 0 if !$found;
|
||||
}
|
||||
|
||||
if ($filter->{'#t'}) {
|
||||
my $found;
|
||||
foreach my $search (@{ $filter->{'#t'} }) {
|
||||
foreach my $tag (@{ $ev->{tags} }) {
|
||||
if ($tag->[0] eq 't' && $tag->[1] eq $search) {
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0 if !$found;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,17 @@ c1e5e04d92d9bd20701bff4cbdac1cdc317d405035883b7adcf9a6a5308d0f54
|
||||
3a15cb7cf951de54a23585ca003c96ca9a7c49fbf8e436575ff9bb710af301f0
|
||||
}];
|
||||
|
||||
my $topics = [qw{
|
||||
bitcoin
|
||||
nostr
|
||||
gitlog
|
||||
introductions
|
||||
jb55
|
||||
damus
|
||||
chat
|
||||
nosuchtopic
|
||||
}];
|
||||
|
||||
sub genRandomFilterGroup {
|
||||
my $useLimit = shift;
|
||||
|
||||
@ -131,6 +142,13 @@ sub genRandomFilterGroup {
|
||||
push @{$f->{'#p'}}, $pubkeys->[int(rand() * @$pubkeys)];
|
||||
}
|
||||
}
|
||||
|
||||
if (rand() < .2) {
|
||||
$f->{'#t'} = [];
|
||||
for (1..(rand()*5)) {
|
||||
push @{$f->{'#t'}}, $topics->[int(rand() * @$topics)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rand() < .2) {
|
||||
|
Reference in New Issue
Block a user