Search::Namazu - Namazu library module for perl
use Search::Namazu; @hlists = Search::Namazu::Search(index => '/usr/local/namazu/index', query => 'foo'); foreach my $hlist (@hlists) { print ($hlist->score, $hlist->uri, $hlist->date, $hlist->rank); } $x = Search::Namazu::Search(index => '/usr/local/namazu/index', query => 'foo', fields => ["uri", "from"]); foreach my $rxs (@$x) { print ($rxs->get("uri"), $rxs->score, $rxs->get("from")); }
This module is an interface for Namazu library. Namazu is an implement of full text retrieval search system. It is available at: http://www.namazu.org/
The module implements Search::Namazu::Search function for searching. When the function is called, it will return the results as an array of Search::Namazu::Result object.
Search::Namazu::Result object has the score, URI, date and ranking as results of searching.
Search::Namazu::Search function has a reference of hash value as the argument. Keys for the hash are the following:
Specify a path of index. If you want to specify a index, you will need to specify the path as a scalar value. However, if you want to specify some indices, you will need to specify the paths as an array reference.
For example:
@result = Search::Namazu::Search( index => ['/var/www/index/site1', '/var/www/index/site2'], query => 'foo' ); $resultref = Search::Namazu::Search( index => ['/var/www/index/site1', '/var/www/index/site2'], query => 'bar', returnas => 'reference' );
Specify a query expression as string. Expression syntax is same as namazu command.
Specify sort method of results. You can use the following values:
Order by date.
Order by score.
Order by fields.
If you ommit this option, it is treated as same as NMZ_SORTBYDATE.
Specify sort order of results. You can use the following values:
Descend order.
Ascend order.
If you ommit this option, it is treated as same as NMZ_DESCENDSORT.
Specify field name when you specified sortMethod as NMZ_SORTBYFIELD.
Specify language.
Speciry maximum numbers of hits. Same as MaxHit directive in namazurc.
Speciry result object numbers of hits to limit too many results. If the parameter was omitted, it is assumed same value as maxhit.
Specify return method, if the parameter is set as 'reference', it returns a reference of array as a result.
Specify you want to get fields as a refrence of array. In the case, the result is returned as a reference of array, contains Search::Namazu::ResultXS objects.
Search::Namazu::Result object is for keeping result information. It has the following methods:
It returns score.
It returns URI.
It returns date.
It returns ranking number.
It returns summary.
It returns title.
It returns author.
It returns size.
Search::Namazu::ResultXS object is also for keeping result information. It has the following methods:
It returns id of document.
It returns id of index.
It returns specified value of field.
Copyright 1999,2000,2001,2002 NOKUBI Takatsugu All rights reserved. This is free software with ABSOLUTELY NO WARRANTY.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
To install Search::Namazu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Search::Namazu
CPAN shell
perl -MCPAN -e shell install Search::Namazu
For more information on module installation, please visit the detailed CPAN module installation guide.