-
-
31 Dec 2014 03:15:36 UTC
- Distribution: Lucy
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Clone repository
- Issues
- Testers (1056 / 65 / 0)
- Kwalitee
Bus factor: 1- License: apache_2_0
- Perl: v5.8.3
- Activity
24 month- Tools
- Download (1.06MB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- The Apache Lucy Project <dev at lucy dot apache dot org>
- Dependencies
- Clownfish
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Lucy::Search::Query - A specification for a search query.
SYNOPSIS
# Query is an abstract base class. package MyQuery; use base qw( Lucy::Search::Query ); sub make_compiler { my ( $self, %args ) = @_; my $subordinate = delete $args{subordinate}; my $compiler = MyCompiler->new( %args, parent => $self ); $compiler->normalize unless $subordinate; return $compiler; } package MyCompiler; use base ( Lucy::Search::Compiler ); ...
DESCRIPTION
Query objects are simple containers which contain the minimum information necessary to define a search query.
The most common way to generate Query objects is to feed a search string such as 'foo AND bar' to a QueryParser's parse() method, which outputs an abstract syntax tree built up from various Query subclasses such as ANDQuery and TermQuery. However, it is also possible to use custom Query objects to build a search specification which cannot be easily represented using a search string.
Subclasses of Query must implement make_compiler(), which is the first step in compiling a Query down to a Matcher which can actually match and score documents.
CONSTRUCTORS
new( [labeled params] )
my $query = MyQuery->SUPER::new( boost => 2.5, );
Abstract constructor.
boost - A scoring multiplier, affecting the Query's relative contribution to each document's score. Typically defaults to 1.0, but subclasses which do not contribute to document scores such as NOTQuery and MatchAllQuery default to 0.0 instead.
ABSTRACT METHODS
make_compiler( [labeled params] )
Abstract factory method returning a Compiler derived from this Query.
searcher - A Searcher.
boost - A scoring multiplier.
subordinate - Indicates whether the Query is a subquery (as opposed to a top-level query). If false, the implementation must invoke normalize() on the newly minted Compiler object before returning it.
METHODS
set_boost(boost)
Set the Query's boost.
get_boost()
Get the Query's boost.
INHERITANCE
Lucy::Search::Query isa Clownfish::Obj.
Module Install Instructions
To install Lucy::Simple, copy and paste the appropriate command in to your terminal.
cpanm Lucy::Simple
perl -MCPAN -e shell install Lucy::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.