The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Search::Namazu - Namazu library module for perl

SYNOPSIS

  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"));
  }

DESCRIPTION

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/

OVERVIEW

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

Search::Namazu::Search function has a reference of hash value as the argument. Keys for the hash are the following:

index

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'
        );

query

Specify a query expression as string. Expression syntax is same as namazu command.

sortMethod

Specify sort method of results. You can use the following values:

NMZ_SORTBYDATE

Order by date.

NMZ_SORTBYSCORE

Order by score.

NMZ_SORTBYFIELD

Order by fields.

If you ommit this option, it is treated as same as NMZ_SORTBYDATE.

sortOrder

Specify sort order of results. You can use the following values:

NMZ_DESCENDSORT

Descend order.

NMZ_ASCENDSORT

Ascend order.

If you ommit this option, it is treated as same as NMZ_DESCENDSORT.

sortField

Specify field name when you specified sortMethod as NMZ_SORTBYFIELD.

lang

Specify language.

maxhit

Speciry maximum numbers of hits. Same as MaxHit directive in namazurc.

maxget

Speciry result object numbers of hits to limit too many results. If the parameter was omitted, it is assumed same value as maxhit.

returnas

Specify return method, if the parameter is set as 'reference', it returns a reference of array as a result.

fields

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

Search::Namazu::Result object is for keeping result information. It has the following methods:

score

It returns score.

uri

It returns URI.

date

It returns date.

rank

It returns ranking number.

summary

It returns summary.

title

It returns title.

author

It returns author.

size

It returns size.

Search::Namazu::ResultXS

Search::Namazu::ResultXS object is also for keeping result information. It has the following methods:

score

It returns score.

date

It returns date.

rank

It returns ranking number.

docid

It returns id of document.

idxid

It returns id of index.

get

It returns specified value of field.

COPYRIGHT

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