Slackware::Slackget::Search - The slack-get search class


Slackware-Slackget documentation  | view source Contained in the Slackware-Slackget distribution.

Index


NAME

Top

Slackware::Slackget::Search - The slack-get search class

VERSION

Top

Version 1.0.0

SYNOPSIS

Top

A class to search for packages on a Slackware::Slackget::PackageList object. This class is a real search engine (I personnally use it couple with the slack-get daemon, on my website), and it has been designed to be easily tunable.

    use Slackware::Slackget::Search;

    my $search = Slackware::Slackget::Search->new($packagelist);
    my @array = $search->search_package($string); # the simplier, search a matching package name
    my @array = $search->search_package_in description($string); # More specialyze, search in the package description
    my @array = $search->search_package_multi_fields($string,@fields); # search in each fields for matching $string

All methods return an array of Slackware::Slackget::Package objects.

CONSTRUCTOR

Top

new

The constructor take a Slackware::Slackget::PackageList object as argument.

	my $search = Slackware::Slackget::Search->new($packagelist);

FUNCTIONS

Top

search_package

This method take a string as parameter search for packages matching the string, and return an array of Slackware::Slackget::Package

	@packages = $packageslist->search_package('gcc');

This method take a string as parameter search for packages where the id is equal to this string. Return the index of the packages in the list.

	$idx = $packageslist->exact_search('perl-mime-base64-3.05-noarch-1');

Same as exact_search() but search on the name of the package instead of its id.

	$idx = $packageslist->exact_search('perl-mime-base64');

search_package_in_description

Take a string as parameter, and search for this string in the package description

	my @array = $search->search_package_in description($string);

search_package_multi_fields

Take a string and a fields list as parameter, and search for this string in the package required fields

	my @array = $search->search_package_multi_fields($string,@fields);

TIPS: you can restrict the search domain by providing fields with restrictions, for example :

	# For a search only in packages from the Slackware source.
	my @results = $search->search_package_multi_fields('burner', 'package-source=slackware', 'description','name');

	# For a search only in packages from the Audioslack source, and only i486 packages
	my @results = $search->search_package_multi_fields('burner', 'package-source=audioslack', 'architecture=i486', 'description','name');

take a reference on an array of string (requests) as first parameters and a reference to an array which contains the list of fields to search in, and perform a search.

This method return an array of Slackware::Slackget::Package as a result. The array is sort by pertinences.

	my @result_array = $search->multi_search(['burn','dvd','cd'],['name','id','description']) ;

You can apply the same tips than for the search_package_multi_fields() method, about the restrictions on search fields.

AUTHOR

Top

DUPUIS Arnaud, <a.dupuis@infinityperl.org>

BUGS

Top

Please report any bugs or feature requests to bug-Slackware-Slackget@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Slackware-Slackget. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Slackware::Slackget




You can also look for information at:

* Infinity Perl website

http://www.infinityperl.org/category/slack-get

* slack-get specific website

http://slackget.infinityperl.org

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Slackware-Slackget

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Slackware-Slackget

* CPAN Ratings

http://cpanratings.perl.org/d/Slackware-Slackget

* Search CPAN

http://search.cpan.org/dist/Slackware-Slackget

ACKNOWLEDGEMENTS

Top

Thanks to Bertrand Dupuis (yes my brother) for his contribution to the documentation.

SEE ALSO

Top

COPYRIGHT & LICENSE

Top


Slackware-Slackget documentation  | view source Contained in the Slackware-Slackget distribution.