KSx::Searcher::Abstract - build searches from Perl data structures


KSx-Searcher-Abstract documentation  | view source Contained in the KSx-Searcher-Abstract distribution.

Index


NAME

Top

KSx::Searcher::Abstract - build searches from Perl data structures

VERSION

Top

 0.002

SYNOPSIS

Top

  use KSx::Searcher::Abstract;

  my $searcher = KSx::Searcher::Abstract->new(%args);

  my $hits = $searcher->search(\%query, \%options);

DESCRIPTION

Top

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

Top

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

Top

  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

Top

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

Top

Hans Dieter Pearcey, <hdp at cpan.org>

BUGS

Top

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

Top

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

http://annocpan.org/dist/KSx-Searcher-Abstract

* CPAN Ratings

http://cpanratings.perl.org/d/KSx-Searcher-Abstract

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=KSx-Searcher-Abstract

* Search CPAN

http://search.cpan.org/dist/KSx-Searcher-Abstract

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


KSx-Searcher-Abstract documentation  | view source Contained in the KSx-Searcher-Abstract distribution.