Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FH/SearchToo fixes

  • Loading branch information...
commit dc6aa73db7cc5358ad875399cc0fd648223b8a00 1 parent 297e411
@pudge pudge authored
View
6 plugins/FireHose/FireHose.pm
@@ -229,8 +229,8 @@ sub getFireHoseEssentials {
my $searchtoo = getObject('Slash::SearchToo');
if ($searchtoo && $searchtoo->handled('firehose')) {
my(%opts, %query);
- $query{query} = $options->{qfilter} if defined $options->{qfilter};
- $query{category} = $options->{category} || '' if $options->{category} || $user->{is_admin};
+ $query{query} = $options->{qfilter} if defined $options->{qfilter};
+ $query{category} = $options->{category} || 'none' if $options->{category} || $user->{is_admin};
if ($options->{ids}) {
if (ref($options->{ids}) eq 'ARRAY' && @{$options->{ids}} < 1) {
return([], {});
@@ -244,7 +244,7 @@ sub getFireHoseEssentials {
}
# still need sorting and filtering by date
- $opts{records_max} = $options->{limit};
+ $opts{records_max} = $options->{limit} unless $options->{nolimit};
$opts{records_start} = $options->{offset} if $options->{offset};
my $results = $searchtoo->findRecords(firehose => \%query, \%opts);
View
5 plugins/SearchToo/SearchToo.pm
@@ -143,7 +143,10 @@ sub _fudge_data {
}
if ($processed{section}) {
- $processed{section_name} ||= $reader->getSkin($processed{section})->{name};
+ my $skin = $reader->getSkin($processed{section});
+ if ($skin) {
+ $processed{section_name} ||= $skin->{name};
+ }
}
View
9 plugins/SearchToo/SearchToo/Indexer.pm
@@ -106,7 +106,9 @@ slashProf('findRecords setup');
$sopts->{total} = 0;
$sopts->{matches} = 0;
$sopts->{start} = $opts->{records_start} || 0;
- $sopts->{max} = $opts->{records_max} || $constants->{search_default_display};
+ $sopts->{max} = defined $opts->{records_max} && length $opts->{records_max}
+ ? $opts->{records_max}
+ : $constants->{search_default_display};
# sort can be an arrayref, but stick with one for now
## no way to sort by date yet
@@ -189,7 +191,7 @@ slashProf('prepare records', 'addRecords setup');
title => $record->{title},
type => $record->{type},
- category => $record->{category},
+ category => $record->{category} || 'none',
note => $record->{note},
popularity => $record->{popularity},
activity => $record->{activity},
@@ -297,7 +299,8 @@ sub getRecords {
my($items) = $firehose->getFireHoseEssentials({
ids => [ map { $_->{id} } @$data ],
fetch_text => 1,
- no_search => 1
+ no_search => 1,
+ nolimit => 1
});
for my $item (@$items) {
View
6 plugins/SearchToo/SearchToo/Kinosearch.pm
@@ -84,7 +84,7 @@ slashProf('init search');
for my $t (keys %$terms) {
next if $t eq 'query';
- next if !$terms->{$t} || !length($terms->{$t});
+ next if !defined($terms->{$t}) || !length($terms->{$t});
# OR by default, for now anyway ... chances are this won't
# ever need to be an AND
@@ -131,11 +131,11 @@ slashProf('init search');
slashProf('search', 'init search');
my $hits = $searcher->search(query => $query || $fquery, filter => $filter);
- $hits->seek($sopts->{start}, $sopts->{max});
-
$sopts->{total} = $preader->num_docs;
$sopts->{matches} = $hits->total_hits;
+ $hits->seek($sopts->{start}, $sopts->{max} || $sopts->{matches});
+
slashProf('fetch results', 'search');
while (my $hit = $hits->fetch_hit_hashref) {
my %data = (
View
5 plugins/SearchToo/search_index.pl
@@ -18,7 +18,7 @@
my $searchtoo = getObject('Slash::SearchToo');
- slashdLog("Backing up index");
+# slashdLog("Backing up index");
# $searchtoo->copyBackup;
# $searchtoo->backup(1);
@@ -71,7 +71,8 @@
# $searchtoo->backup(0);
# $searchtoo->moveLive;
- slashdLog("Moved new index live");
+# slashdLog("Moved new index live");
+ slashdLog("Finished");
};
1;
Please sign in to comment.
Something went wrong with that request. Please try again.