NAME
NexTrieve - Perl interface to NexTrieve search engine software
SYNOPSIS
use NexTrieve;
$ntv = new NexTrieve( | {method => value} );
# doing everything in Perl
$search = $ntv->Search( host:port | port | resourcefile | $resource );
$hitlist = $search->Hitlist( $query | queryfile | xml | {method => value} );
foreach $hit ($hitlist->Hits) {
# display result here
}
# if you want to process your own XML
$hitlistxml = $ntv->ask_server_port( server:port | port,$queryxml );
DESCRIPTION
Provide a Perl interface to the complete functionality of NexTrieve.
Almost all aspects of NexTrieve are handled through XML. If you are not well versed in the handling of XML, and you are well versed in using Perl, then these Perl modules are for you: they will handle everything in a completely object-oriented manner.
The following modules are part of the basic distribution:
NexTrieve base module
NexTrieve::Collection logical collection object
NexTrieve::Daemon logical daemon object
NexTrieve::Docseq logical document sequence for indexing
NexTrieve::Document logical document object
NexTrieve::Resource create/adapt resource-file
NexTrieve::Index index XML
NexTrieve::Replay turn Querylog into Hitlist objects for a Search
NexTrieve::Search logical search engine object
NexTrieve::Query create/adapt query
NexTrieve::Querylog turn query log into Query objects
NexTrieve::Hitlist result of query from search engine
NexTrieve::Hitlist::Hit a single hit of the result
If you are used to handling XML in Perl, you probably only need the IO::Socket module to perform searches with NexTrieve. Or you can use the method ask_server_port, which provides a shortcut for that.
SELECTIVE SUBMODULE LOADING
Not all of the NexTrieve submodules may be needed in a particular situation. In order to save CPU and memory, you can easily load only the necessary submodules, by specifying their names in the -use- statement with which you load this module. E.g.,
use NexTrieve; or use NexTrieve qw(:all);
will load all submodules of NexTrieve (which may become more over the course of time). If you would only like to use the NexTrieve::Query submodule, you can specify this as:
use NexTrieve qw(Query Hitlist);
This can e.g. be handy if you only want to use the Query and Hitlist features.
SETUP METHODS
The following methods are available for setting up the NexTrieve object itself.
ask_server_port
$hitlistxml = $ntv->ask_server_port( server:port | port,$queryxml );
INHERITED METHODS
The following methods are inherited from the NexTrieve object whenever any of the sub-objects are made. This means that any setting in the NexTrieve object of these methods, will automatically be activated in the sub-objects in the same manner.
DieOnError
$DieOnError = $ntvobject->DieOnError;
$ntvobject->DieOnError( true | false );
NexTrievePath
$NexTrievePath = $ntv->NexTrievePath;
$ntv->NexTrievePath( '/usr/local/nextrieve/bin' ); # checks NTV_PATH=
NexTrieveVersion
$NexTrieveVersion = $ntv->NexTrieveVersion;
$ntv->NexTrieveVersion( '2.0.0' ); # short for /usr/local/nextrieve/2.0.0
ShowErrorsAsWarnings
$ShowErrorsAsWarnings = $ntvobject->ShowErrorsAsWarnings;
$ntvobject->ShowErrorsAsWarnings( true | false );
Tmp
$Tmp = $ntv->Tmp;
$ntv->Tmp( '/tmp' ); # checks TMP=
CONVENIENCE METHODS
The following methods are inheritable from the NexTrieve module. They are intended to make life easier for the developer, and are specifically intended to be used within user scripts such as templates.
Set
$ntvobject->Set( {
methodname1 => $value1,
methodname2 => $value2,
methodname2 => [parameter1,parameter2],
} );
Get
($var1,$var2) = $ntvobject->Get( qw(methodname1 methodname2) );
$ntvobject->Get( qw(methodname1 methodname2) ); # sets global vars
Errors
@error = $ntvobject->Errors;
XML METHODS
The following methods have to do with all of the objects that are directly related to the XML representation used by NexTrieve. They are inherited from the NexTrieve module by NexTrieve::Resource, NexTrieve::Query and NexTrieve::Hitlist.
filename
$filename = $ntvobject->filename;
$ntvobject->filename( filename );
encoding
$encoding = $ntvobject->encoding;
$ntvobject->encoding( $encoding ); # sets default on $ntv
version
$version = $ntvobject->version;
xml
$xml = $ntvobject->xml;
$ntvobject->xml( $xml );
read_file
$ntvobject->read_file( file );
read_fh
open( $handle,file );
$ntvobject->read_fh( $handle );
close( $handle );
read_string
$ntvobject->read_string( xml );
write_string
$xml = $ntvobject->write_string;
write_fh
open( $handle,">file" );
$ntvobject->write_fh( $handle );
close( $handle );
write_file
$ntvobject->write_file( | file );
AUTHOR
Elizabeth Mattijsen, <liz@nextrieve.com>.
Please report bugs to <perlbugs@nextrieve.com>.
COPYRIGHT
Copyright (c) 1995-2002 Elizabeth Mattijsen <liz@nextrieve.com>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
http://www.nextrieve.com and the other NexTrieve::xxx modules.