text
stringlengths
0
834k
8. Mail-FilterXML [0.1] Matthew MacKenzie (matt@goxml.com)
9. Mail-XML [0.03] Matthew MacKenzie (matt@goxml.com)
10. Pod-XML [0.93] Matt Sergeant (matt@sergeant.org)
You can change the order in which the results are sorted, and what
columns are displayed. The settings *fields* and *sort-field* changes
this. You can sort by any valid field name (even fields which are not
displayed). See the *settings* command for the valid field names.
PPM always hides ""duplicate"" results. It decides whether a result is
duplicated based on the fields being displayed. If the same package is
found in more than one repository, but you don't have the REPOSITORY
field showing, PPM will only list the package once.
END
sub comp_search {()}
sub run_search {
my $o = shift;
my @args = @_;
my $query = $o->raw_args || join ' ', @args;
trace(1, ""PPM: search @args\n\tquery='$query'\n"");
return unless $o->assert(
scalar $o->reps_on,
""you must activate a repository before searching.""
);
# No args: show cached result sets
unless (@args) {
my @search_results = $o->cache_sets('search');
my $search_result_current = $o->cache_set_current('search');
if (@search_results) {
$o->inform(""Search Result Sets:\n"");
my $i = 0;
for (@search_results) {
$o->informf(""%s%2d"",
$search_result_current == $i ? ""*"" : "" "",
$i + 1);
$o->inform("". $_->{query}\n"");
$i++;
}
}
else {
$o->warn(""No search result sets -- provide a search term.\n"");
return;
}
}
# Args:
else {
# Show specified result set
if ($query =~ /^\d+/) {
my $set = int($query);
my $s = $o->cache_set('search', $set - 1);
unless ($set > 0 and defined $s) {
$o->warn(""No such search result set '$set'.\n"");
return;
}
$query = $o->cache_set('search', $set-1, 'query');
$o->inform(""Search Results Set $set ($query):\n"");
$o->print_formatted($s, $o->cache_set_index('search'));
$o->cache_set_current('search', $set-1);
$o->cache_set_index('search', -1);
}
# Query is the same as a previous query on the same repository:
# Use cached results and set them as default
elsif(grep { $_->{query} eq $query } $o->cache_sets('search')) {
my @entries = $o->cache_sets('search');
for (my $i=0; $i<@entries; $i++) {
if ($o->cache_set('search', $i, 'query') eq $query) {
$o->inform(""Using cached search result set "", $i+1, "".\n"");
$o->cache_set_current('search', $i);
my $set = $o->cache_set('search');
$o->print_formatted($set);
}
}
}
# Perform a new search
else {
my @rlist = $o->reps_on;
my $targ = $o->conf('target');
my $case = not $o->conf('case-sensitivity');
$o->inform(""Searching in Active Repositories\n"");
my $ok = PPM::UI::search(\@rlist, $targ, $query, $case);
unless ($ok->is_success) {
$o->warn($ok->msg);
return unless $ok->ok;
}
my @matches = $ok->result_l;
unless (@matches) {
$o->warn(""No matches for '$query'; see 'help search'.\n"");
return 1;
}
$o->cache_set_index('search', -1);
$o->cache_set_add('search', $query, \@matches);
$o->cache_set_current('search', scalar($o->cache_sets('search')) - 1);
my @set = $o->cache_set('search');
$o->print_formatted(\@set);