NAME
KSx::Searcher::Abstract - build searches from Perl data structures
VERSION
0.002
SYNOPSIS
my
$searcher
= KSx::Searcher::Abstract->new(
%args
);
my
$hits
=
$searcher
->search(\
%query
, \
%options
);
DESCRIPTION
KSx::Searcher::Abstract is intended to be a simple and flexible search builder for KinoSearch, analogous to SQL::Abstract and its role in the DBI world.
Wherever possible, KSx::Searcher::Abstract copies or mimics SQL::Abstract's query building behavior.
LIMITATIONS
Currently, only a single level of query data is supported, e.g.
$searcher
->search({
foo
=> 1,
bar
=> 2 })
All queries are effectively joined with AND.
In the future, nested conditions and conditions joined with OR should be supported.
METHODS
search
my
$hits
=
$searcher
->search(\
%query
, \
%options
);
Build a query and search with it. See "QUERY SYNTAX" and KinoSearch::Searcher.
build_abstract
my
%arg
=
$searcher
->build_abstract(\
%query
, \
%options
);
Builds input for KinoSearch::Searcher from the supplied query and options hashrefs. This is called automatically by search
; you should not need to use it.
QUERY SYNTAX
Each query is built from a hashref. The keys are field names and the values are constraints.
The simplest kind of constraint is a scalar. This translates directly into a TermQuery for that field and value.
{
foo
=> 1 }
More complex constraints are available using a hashref.
{
foo
=> {
'='
=> 1 } }
# foo = 1, equivalent to the first example
{
foo
=> {
'!='
=> 1 } }
# foo != 1
Watch this space as more constraints become available (see "LIMITATIONS").
AUTHOR
Hans Dieter Pearcey, <hdp at cpan.org>
BUGS
Please report any bugs or feature requests to bug-ksx-searcher-abstract at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=KSx-Searcher-Abstract. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc KSx::Searcher::Abstract
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=KSx-Searcher-Abstract
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2007 Hans Dieter Pearcey, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.